Random Number Generator
From C++ to PHP, debugging to webhosting; help and discussion about writing your latest program to running your website. NOT for help when your PC won't work.
| Announcements | Posted on | |
|---|---|---|
| Please change your TSR password | 23-05-2013 | |
| Enter our travel-writing competition for the chance to win a Nikon 1 J3 camera | 20-05-2013 | |
-
Random Number Generator
I am looking for a very visual random number generator, something which I can use to pick a number for a lottery, but have a lot of suspense during it for the people who are taking part.
On the internet, I can only find website such as random.org which instantly show the random number, I want something which upon clicking does some kind of animation (or something) and then displays the number. Ideally taking about 20-30 seconds.
Would anyone know of something like this which already exists, or could have a go at making something I could run on my computer?
It doesn't need to be attached to a website since the generating of the final number will be done via a live stream from my computer. With that in mind, it would be nice if it was since then people could try it, and see that it is completely random.
Thanks! -
Re: Random Number GeneratorI would make it myself, but I have no idea where to start. When I get in from work tonight I shall do a bit more research in to it myself, but I was hoping someone on here could give me some kind of starting point.(Original post by Prokaryotic_crap)
why don't you make it yourself? Like the above person said, from a programming view, it is very easy..
How would one go about doing it? Language wise? :P -
Re: Random Number GeneratorC# using Visual Studio.(Original post by Dastrea)
I would make it myself, but I have no idea where to start. When I get in from work tonight I shall do a bit more research in to it myself, but I was hoping someone on here could give me some kind of starting point.
How would one go about doing it? Language wise? :P
http://www.microsoft.com/visualstudi...itions/express
Generating a random number is trivial, it's one line of code. Creating a window and a button to trigger it is also very easy (there's a GUI designer). The animation is the harder bit, you'll have to decide what you want do for that.
That would be my choice anyway. -
Re: Random Number GeneratorAny Visual Studio Language (Visual Basic, Visual C# etc) should make this straightforward. You could do something like a "fruit machine" effect where a series of numbers flick through a text box until it settles on a final value...(Original post by Dastrea)
I would make it myself, but I have no idea where to start. When I get in from work tonight I shall do a bit more research in to it myself, but I was hoping someone on here could give me some kind of starting point.
How would one go about doing it? Language wise? :P -
Re: Random Number GeneratorThat's the type of thing that I would like but I am still clueless about how I am going to get it.(Original post by davros)
Any Visual Studio Language (Visual Basic, Visual C# etc) should make this straightforward. You could do something like a "fruit machine" effect where a series of numbers flick through a text box until it settles on a final value...
Ehh, this will do, it's nothing important. Just a small little lottery draw(Original post by THESHade)
I just want to let you know that usually the "random" functions in many languages aren`t completely random
but that`s all right as they are really close to it and it would be very hard for somebody to get an edge over it.
-
Re: Random Number GeneratorWell, I'm no great graphics artist myself(!), but something like a reasonably-sized text box or picture box that can hold digits (or double digits) in a large text font (size 24+) would probably do.(Original post by Dastrea)
That's the type of thing that I would like but I am still clueless about how I am going to get it.
The language itself (Basic or C#) will have a function for generating random numbers between upper and lower limits, so you could just run some sort of loop that flashes/rolls 1000 numbers and then stops - you'd probably have to stick some sort of timer or delay in it otherwise the effect would be invisible! -
Re: Random Number GeneratorUsually? They're never completely random. To be completely random it would have to use some physical source of entropy such as a piece of radioactive material.(Original post by THESHade)
I just want to let you know that usually the "random" functions in many languages aren`t completely random
but that`s all right as they are really close to it and it would be very hard for somebody to get an edge over it.
Computers can generate pseudo random numbers. They basically take a number from some outside source (usually the current time), run it through some complicated equation, and come up with a number which doesn't appear to have any relation to what you put in. Typically they then use that number to generate another one when you want a new random number.
It's not completely random, but the numbers you get are far, far more random than the numbers you'd get if you asked a person to pick random numbers. -
Re: Random Number GeneratorHaha, true to that(Original post by Psyk)
Usually? They're never completely random. To be completely random it would have to use some physical source of entropy such as a piece of radioactive material.
Computers can generate pseudo random numbers. They basically take a number from some outside source (usually the current time), run it through some complicated equation, and come up with a number which doesn't appear to have any relation to what you put in. Typically they then use that number to generate another one when you want a new random number.
It's not completely random, but the numbers you get are far, far more random than the numbers you'd get if you asked a person to pick random numbers.
Humans always have pattern when picking "random" numbers, and most people have the same pattern
Best thing is we don`t even realize that
Poker rooms have probably the best (or one of the best) RNGs which are pretty all right -
Re: Random Number GeneratorYou should read chapter 3 of TAOCP.(Original post by THESHade)
Haha, true to that
Humans always have pattern when picking "random" numbers, and most people have the same pattern
Best thing is we don`t even realize that
Poker rooms have probably the best (or one of the best) RNGs which are pretty all right -
Re: Random Number Generator
Another consideration if you're picking sets of lottery numbers is that you need to prevent the same number occurring twice in the same set (irl this is achieved by removing the balls from the tumbler machine)
fwiw if anyone's really interested in testing prngs there's a test suite called 'dieharder' available as C source. -
Re: Random Number GeneratorWell, I use Java but I would imagine in any programming language it would be very trivial.(Original post by Dastrea)
I would make it myself, but I have no idea where to start. When I get in from work tonight I shall do a bit more research in to it myself, but I was hoping someone on here could give me some kind of starting point.
How would one go about doing it? Language wise? :P
In Java, assuming you only want a simple command line program: have a scanner object that takes the input from the user and stores in a int variable. then create and array with all the alphabet, in both cases and the numbers from 0 to 9. Then have some random number pick a character from the array and print in in some kind of loop.
There are probably other more sophisticated ways, but this is just at the top of my head.
Humans always have pattern when picking "random" numbers, and most people have the same pattern