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
Sign in to Reply
  1. Dastrea's Avatar
    • Exalted Member
    • Location: Surrey
    • Posts: 342
    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!
  2. Psyk's Avatar
    • TSR Royalty
    • Location: Leamington Spa
    • Posts: 19,109
    Re: Random Number Generator
    It would be a very easy thing to make from a programming point of view. Depends what sort of animation you want.
  3. Prokaryotic_crap's Avatar
    • TSR Demigod
    • Location: Em City, Oz
    Re: Random Number Generator
    why don't you make it yourself? Like the above person said, from a programming view, it is very easy..
  4. Dastrea's Avatar
    • Exalted Member
    • Location: Surrey
    • Posts: 342
    Re: Random Number Generator
    (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..
    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
  5. Psyk's Avatar
    • TSR Royalty
    • Location: Leamington Spa
    • Posts: 19,109
    Re: Random Number Generator
    (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
    C# using Visual Studio.

    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.
  6. davros's Avatar
    • Overlord in Training
    • Location: Skaro
    Re: Random Number Generator
    (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
    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...
  7. THESHade's Avatar
    • Adored and Respected Member
    • Location: Slovakia
    • Posts: 450
    Re: Random Number Generator
    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.
  8. Dastrea's Avatar
    • Exalted Member
    • Location: Surrey
    • Posts: 342
    Re: Random Number Generator
    (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...
    That'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 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.
    Ehh, this will do, it's nothing important. Just a small little lottery draw
  9. davros's Avatar
    • Overlord in Training
    • Location: Skaro
    Re: Random Number Generator
    (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.
    Well, 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.

    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!
  10. Psyk's Avatar
    • TSR Royalty
    • Location: Leamington Spa
    • Posts: 19,109
    Re: Random Number Generator
    (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.
    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.
  11. THESHade's Avatar
    • Adored and Respected Member
    • Location: Slovakia
    • Posts: 450
    Re: Random Number Generator
    (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.
    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
  12. alex-hs's Avatar
    • Overlord in Training
    • Location: Nottingham
    • Posts: 3,088
    Re: Random Number Generator
    (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
    You should read chapter 3 of TAOCP.
  13. Joinedup's Avatar
    • TSR Demigod
    • Posts: 7,495
    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.
  14. Prokaryotic_crap's Avatar
    • TSR Demigod
    • Location: Em City, Oz
    Re: Random Number Generator
    (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
    Well, I use Java but I would imagine in any programming language it would be very trivial.

    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.
Sign in to Reply
Share this discussion:  
Useful resources
Article updates
Moderators

We have a brilliant team of more than 60 volunteers looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Reputation gems:
The Reputation gems seen here indicate how well reputed the user is, red gem indicate negative reputation and green indicates a good rep.
Post rating score:
These scores show if a post has been positively or negatively rated by our members.