The Naked Scientists

The Naked Scientists Forum

Author Topic: How efficient are random number generators  (Read 4197 times)

Offline syhprum

  • Neilep Level Member
  • ******
  • Posts: 3818
  • Thanked: 19 times
    • View Profile
How efficient are random number generators
« on: 04/12/2009 10:18:18 »
The numbers for the national lottery are generated by a crude but colourful machine there are of course much better ways to generate them than this.
How efficient are are generators ?, how can they be tested ?.
(My guess at the number of shuffles required to return the playing cards to their original state was 52! [8.0658 * 10^67] is this correct ?)


 

Offline LeeE

  • Neilep Level Member
  • ******
  • Posts: 3382
    • View Profile
    • Spatial
How efficient are random number generators
« Reply #1 on: 04/12/2009 16:36:37 »
Random (white) noise based random number generators are quite good but software random number generators just generate pseudo-random numbers based upon different seed values.
 

Offline Geezer

  • Neilep Level Member
  • ******
  • Posts: 8328
  • "Vive la résistance!"
    • View Profile
How efficient are random number generators
« Reply #2 on: 05/12/2009 05:30:50 »
The numbers for the national lottery are generated by a crude but colourful machine there are of course much better ways to generate them than this.
How efficient are are generators ?, how can they be tested ?.
(My guess at the number of shuffles required to return the playing cards to their original state was 52! [8.0658 * 10^67] is this correct ?)

I agree. For a 52 card deck, there are 52!(factorial) possible combinations.

Here's a sort of proof. For a 4 card deck (cards A, B, C & D) thare are 24 possible combinations.

4!=4x3x2x1=24

Here are the possible combinations.

ABCD ABDC ACBD ACDB ADCB ADBC
BABC BACB BCAB BCBA BDAC BDCA
CABD CADB CBAD CBDA CDAB CDBA
DABC DACB DBCA DBAC DCAB DCBA

It's not quite legit to say that the cards in a 52 card deck will return to their original state in 52! shuffles. Each shuffle is independent (or should be!) of the previous shuffle. All we can say is that for each shuffle, there is a 1 in 52! chance that the cards will be in a particular order, so it could happen on the next shuffle, or the cards and/or the shuffler may disintegrate before it happens.

Actually, the crude machines with the ping-pong balls (I'm assuming that's what they use in the UK) are really quite random. Because everyone can see what's going on, they are very difficult to bias (cheat). On the other hand it is very easy to bias what's going on inside a piece of electronic equipment.
« Last Edit: 05/12/2009 05:32:36 by Geezer »
 

Offline syhprum

  • Neilep Level Member
  • ******
  • Posts: 3818
  • Thanked: 19 times
    • View Profile
How efficient are random number generators
« Reply #3 on: 05/12/2009 08:25:51 »
I was able to confirm my guess as to what my chance of selecting the correct 6 balls from the 49 shuffled was i.e 49!/43!*6! (13,983,816)
Why do suckers spend their money !.
I wonder how truly random these ping pong ball machines are, I would think some bias arises from how the balls are stacked in the machine and their relative weights and aerodynamic properties.
I repeat my original question how do you test random number generating systems ?. 

I was surprised that I could do these calculations on my cheap 20 year old pocket calculator, I checked with Mathmetica and found them to be correct.
« Last Edit: 05/12/2009 08:39:12 by syhprum »
 

Offline Geezer

  • Neilep Level Member
  • ******
  • Posts: 8328
  • "Vive la résistance!"
    • View Profile
How efficient are random number generators
« Reply #4 on: 05/12/2009 19:16:18 »
Good point about testing! I suppose the only way is to generate a very large set of numbers and try to detect a bias. If it's a significant bias, it will be fairly obvious, but if it's only a very small bias, it may be undetectable. Maybe there is a more scientific approach?
 

Offline JP

  • Neilep Level Member
  • ******
  • Posts: 3366
  • Thanked: 2 times
    • View Profile
How efficient are random number generators
« Reply #5 on: 06/12/2009 03:10:32 »
In principle, you could make a quantum random number generator,  which would probably be the ultimate random number generator, since quantum mechanics has some inherent randomness in it.

Googling for it turned up the Wiki link, which has some interesting points: http://en.wikipedia.org/wiki/Hardware_random_number_generator
 

Offline Geezer

  • Neilep Level Member
  • ******
  • Posts: 8328
  • "Vive la résistance!"
    • View Profile
How efficient are random number generators
« Reply #6 on: 06/12/2009 05:55:40 »
Syhprum raises a very interesting question. With his permission, I might re-phrase it as,

"How do we know a random nunber generator generates randon nummbers?"
 

Offline syhprum

  • Neilep Level Member
  • ******
  • Posts: 3818
  • Thanked: 19 times
    • View Profile
How efficient are random number generators
« Reply #7 on: 06/12/2009 08:31:26 »
Thanks to Jpetruccelli for the link it certainly gives a exhaustive review of the subject.
 

Offline glovesforfoxes

  • Sr. Member
  • ****
  • Posts: 372
  • Matthew 6:21
    • View Profile
How efficient are random number generators
« Reply #8 on: 06/12/2009 13:22:03 »
http://www.random.org/

Great site which explores ideas of randomness also.

They use atmospheric noise to generate randomness. So no code can be used to figure out a pattern for it, even if it is not truly random no one knows the mechanism behind it.
 

Offline syhprum

  • Neilep Level Member
  • ******
  • Posts: 3818
  • Thanked: 19 times
    • View Profile
How efficient are random number generators
« Reply #9 on: 06/12/2009 15:35:50 »
I used it to generate a national lottery string, I will not waste a pound GB but will be horrified if it comes up !

      12 22 33 47 32 27
 

Offline Geezer

  • Neilep Level Member
  • ******
  • Posts: 8328
  • "Vive la résistance!"
    • View Profile
How efficient are random number generators
« Reply #10 on: 06/12/2009 18:10:44 »
I will use my telekinetic ability to make your numbers come up. When do they pick them?
 

Offline syhprum

  • Neilep Level Member
  • ******
  • Posts: 3818
  • Thanked: 19 times
    • View Profile
How efficient are random number generators
« Reply #11 on: 06/12/2009 21:40:51 »
Please don't it would be horrible if the numbers came up as I do not intend to buy a ticket
 

Offline Geezer

  • Neilep Level Member
  • ******
  • Posts: 8328
  • "Vive la résistance!"
    • View Profile
How efficient are random number generators
« Reply #12 on: 06/12/2009 22:18:02 »
Oh dear! I initiated the sequence and I can't stop it. I'll have to redirect the force to something else. Keep an eye on your box of cornflakes. I'll try to invert it instead.
 

The Naked Scientists Forum

How efficient are random number generators
« Reply #12 on: 06/12/2009 22:18:02 »

 

SMF 2.0.10 | SMF © 2015, Simple Machines
SMFAds for Free Forums