Re: [Tutor] How trustworthy are pseudo-random numbers?
Andre Engels wrote: On Fri, Oct 3, 2008 at 5:25 PM, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Is your math correct? That's ridiculously large. 1 year equals 3600 * 24 * 365 makes about 3*10^8 seconds. The universe is about 15.000.000.000 years old, that's about 5*10^17 seconds. With 1 billion combinations per second, each computer does 5*10^26 combinations in that time. There are something like 10^70 or 10^72 particles in the universe, thus N is about 10^100, give or take a factor of thousand or so. N2 is equal to 5*10^17 * N * N, which we will round up to 10^220. N3 by that same calculation will be about 10^460. The unnamed last number that way becomes something like 10^940 (in reality, because of all the rounding up, more like 10^930). That's less than 1/10^600 of 10^1600 - I'd say that's dwarved by any definition of the word. Wowee! Golleee! Gosh! That sure be some fine number crunching. Robert ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How trustworthy are pseudo-random numbers?
2008/10/3 Andre Engels <[EMAIL PROTECTED]>: > On Fri, Oct 3, 2008 at 4:11 PM, Daniele <[EMAIL PROTECTED]> wrote: > If you used every atom in the known universe as a computer, then let > them turn out a billion combinations a second for the entire time > since the big bang, and call the number of combination you get then > N [...].. then the number of combinations turned out by N3 computers turning > out > N3 combinations per second in the time since the big bang STILL > dwarves in comparison to that number. Excellent Proof of concept! ,-) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How trustworthy are pseudo-random numbers?
On Fri, Oct 3, 2008 at 5:32 PM, Andre Engels <[EMAIL PROTECTED]> wrote: > On Fri, Oct 3, 2008 at 5:25 PM, Luke Paireepinart > <[EMAIL PROTECTED]> wrote: >> Is your math correct? That's ridiculously large. > > 1 year equals 3600 * 24 * 365 makes about 3*10^8 seconds. > The universe is about 15.000.000.000 years old, that's about 5*10^17 seconds. > With 1 billion combinations per second, each computer does 5*10^26 > combinations in that time. > There are something like 10^70 or 10^72 particles in the universe, > thus N is about 10^100, give or take a factor of thousand or so. > N2 is equal to 5*10^17 * N * N, which we will round up to 10^220. > N3 by that same calculation will be about 10^460. > The unnamed last number that way becomes something like 10^940 (in > reality, because of all the rounding up, more like 10^930). That's > less than 1/10^600 of 10^1600 - I'd say that's dwarved by any > definition of the word. Oh, wait, I had to compare to 10^6001 instead of 10^1600... Which means I could have gone on to N6 instead of N4. >> On Fri, Oct 3, 2008 at 10:03 AM, Andre Engels <[EMAIL PROTECTED]> wrote: >>> On Fri, Oct 3, 2008 at 4:11 PM, Daniele <[EMAIL PROTECTED]> wrote: >From here http://en.wikipedia.org/wiki/Pseudorandom_number_generator#Periodicity and here http://en.wikipedia.org/wiki/Mersenne_twister#Advantages I think it can be argued that the randomness is pretty trustworthy :o) >>> >>> Nice understatement on that last page - "most applications do not >>> require 2^19937 unique combinations (2^19937 is approximately 4.315425 >>> × 10^6001)." >>> >>> If you used every atom in the known universe as a computer, then let >>> them turn out a billion combinations a second for the entire time >>> since the big bang, and call the number of combination you get then >>> N... >>> then take N computers turning out N combinations a second for the >>> entire time since the big bang, and call the number of combinations >>> they turn out N2... >>> then take N2 computers turning out N2 combinations a second and call >>> the number of combination they turn out in the time since the big bang >>> and call that N3... >>> then the number of combinations turned out by N3 computers turning out >>> N3 combinations per second in the time since the big bang STILL >>> dwarves in comparison to that number. >>> >>> >>> -- >>> André Engels, [EMAIL PROTECTED] >>> ___ >>> Tutor maillist - Tutor@python.org >>> http://mail.python.org/mailman/listinfo/tutor >>> >> > > > > -- > André Engels, [EMAIL PROTECTED] > -- André Engels, [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How trustworthy are pseudo-random numbers?
On Fri, Oct 3, 2008 at 5:25 PM, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > Is your math correct? That's ridiculously large. 1 year equals 3600 * 24 * 365 makes about 3*10^8 seconds. The universe is about 15.000.000.000 years old, that's about 5*10^17 seconds. With 1 billion combinations per second, each computer does 5*10^26 combinations in that time. There are something like 10^70 or 10^72 particles in the universe, thus N is about 10^100, give or take a factor of thousand or so. N2 is equal to 5*10^17 * N * N, which we will round up to 10^220. N3 by that same calculation will be about 10^460. The unnamed last number that way becomes something like 10^940 (in reality, because of all the rounding up, more like 10^930). That's less than 1/10^600 of 10^1600 - I'd say that's dwarved by any definition of the word. > On Fri, Oct 3, 2008 at 10:03 AM, Andre Engels <[EMAIL PROTECTED]> wrote: >> On Fri, Oct 3, 2008 at 4:11 PM, Daniele <[EMAIL PROTECTED]> wrote: >>> >From here >>> http://en.wikipedia.org/wiki/Pseudorandom_number_generator#Periodicity >>> and here >>> http://en.wikipedia.org/wiki/Mersenne_twister#Advantages >>> >>> I think it can be argued that the randomness is pretty trustworthy :o) >> >> Nice understatement on that last page - "most applications do not >> require 2^19937 unique combinations (2^19937 is approximately 4.315425 >> × 10^6001)." >> >> If you used every atom in the known universe as a computer, then let >> them turn out a billion combinations a second for the entire time >> since the big bang, and call the number of combination you get then >> N... >> then take N computers turning out N combinations a second for the >> entire time since the big bang, and call the number of combinations >> they turn out N2... >> then take N2 computers turning out N2 combinations a second and call >> the number of combination they turn out in the time since the big bang >> and call that N3... >> then the number of combinations turned out by N3 computers turning out >> N3 combinations per second in the time since the big bang STILL >> dwarves in comparison to that number. >> >> >> -- >> André Engels, [EMAIL PROTECTED] >> ___ >> Tutor maillist - Tutor@python.org >> http://mail.python.org/mailman/listinfo/tutor >> > -- André Engels, [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How trustworthy are pseudo-random numbers?
Is your math correct? That's ridiculously large. On Fri, Oct 3, 2008 at 10:03 AM, Andre Engels <[EMAIL PROTECTED]> wrote: > On Fri, Oct 3, 2008 at 4:11 PM, Daniele <[EMAIL PROTECTED]> wrote: >> >From here >> http://en.wikipedia.org/wiki/Pseudorandom_number_generator#Periodicity >> and here >> http://en.wikipedia.org/wiki/Mersenne_twister#Advantages >> >> I think it can be argued that the randomness is pretty trustworthy :o) > > Nice understatement on that last page - "most applications do not > require 2^19937 unique combinations (2^19937 is approximately 4.315425 > × 10^6001)." > > If you used every atom in the known universe as a computer, then let > them turn out a billion combinations a second for the entire time > since the big bang, and call the number of combination you get then > N... > then take N computers turning out N combinations a second for the > entire time since the big bang, and call the number of combinations > they turn out N2... > then take N2 computers turning out N2 combinations a second and call > the number of combination they turn out in the time since the big bang > and call that N3... > then the number of combinations turned out by N3 computers turning out > N3 combinations per second in the time since the big bang STILL > dwarves in comparison to that number. > > > -- > André Engels, [EMAIL PROTECTED] > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How trustworthy are pseudo-random numbers?
On Fri, Oct 3, 2008 at 4:11 PM, Daniele <[EMAIL PROTECTED]> wrote: > >From here > http://en.wikipedia.org/wiki/Pseudorandom_number_generator#Periodicity > and here > http://en.wikipedia.org/wiki/Mersenne_twister#Advantages > > I think it can be argued that the randomness is pretty trustworthy :o) Nice understatement on that last page - "most applications do not require 2^19937 unique combinations (2^19937 is approximately 4.315425 × 10^6001)." If you used every atom in the known universe as a computer, then let them turn out a billion combinations a second for the entire time since the big bang, and call the number of combination you get then N... then take N computers turning out N combinations a second for the entire time since the big bang, and call the number of combinations they turn out N2... then take N2 computers turning out N2 combinations a second and call the number of combination they turn out in the time since the big bang and call that N3... then the number of combinations turned out by N3 computers turning out N3 combinations per second in the time since the big bang STILL dwarves in comparison to that number. -- André Engels, [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How trustworthy are pseudo-random numbers?
>> [Alec Henriksen] >> > How trustworthy is the "randomness" generated by the random module? >> >> Python uses the Mersenne Twister algorithm for generating >> pseudo-random numbers, and that's one of the highest-quality methods >> known. >From here http://en.wikipedia.org/wiki/Pseudorandom_number_generator#Periodicity and here http://en.wikipedia.org/wiki/Mersenne_twister#Advantages I think it can be argued that the randomness is pretty trustworthy :o) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How trustworthy are pseudo-random numbers?
On Fri, Oct 3, 2008 at 12:44 AM, Tim Peters <[EMAIL PROTECTED]> wrote: > [Alec Henriksen] > > How trustworthy is the "randomness" generated by the random module? > > Python uses the Mersenne Twister algorithm for generating > pseudo-random numbers, and that's one of the highest-quality methods > known. I've talked with some people about random number generation, and how you can tell if it's random. For 10 numbers, is 5 5 5 5 5 5 5 5 5 5 random? You really don't know, because it's random! It probably is. Even if the set before and after are all the same, it still could be - that's the beauty of randomness, is sometimes you can get what looks like patterns. Of course, if you're working with data encryption, this is simply not a very reliable way to do things. One of the most "random" ways (of course if you were able to /exactly/ duplicate the circumstances, you'd still get the same result. However it's much more difficult to duplicate the circumstances with this method.) I've seen to generate a number is getting sound input from the mic jack when there's no mic attached, and treating it like string data, then using that as your key. Hooray for Random! -Wayne ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How trustworthy are pseudo-random numbers?
[Alec Henriksen] > How trustworthy is the "randomness" generated by the random module? Python uses the Mersenne Twister algorithm for generating pseudo-random numbers, and that's one of the highest-quality methods known. You can read more about it, e.g., here: http://en.wikipedia.org/wiki/Mersenne_Twister > I just wrote a script (with the help of some tutors here!) that finds > the largest streak in a series of coin flips. > > My collected data: > > 100 coin flips = 6-7 streak (usually) > 1000 coin flips = 10-12 streak (usually) > 1 coin flips = 15-19 streak (usually) > etc etc. > > I'm curious, how much can I trust the randomness? For this purpose, you can have high confidence -- provided your program is correct ;-) > I can't really do 10 coin flips in real life to compare... The theoretical expected maximum run length is given by equation (15) here, with p=0.5 and n=10: http://mathworld.wolfram.com/Run.html although I'm not certain that coincides with what you mean by "streak". ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] How trustworthy are pseudo-random numbers?
Hello list, How trustworthy is the "randomness" generated by the random module? I just wrote a script (with the help of some tutors here!) that finds the largest streak in a series of coin flips. My collected data: 100 coin flips = 6-7 streak (usually) 1000 coin flips = 10-12 streak (usually) 1 coin flips = 15-19 streak (usually) etc etc. I'm curious, how much can I trust the randomness? I can't really do 10 coin flips in real life to compare... -- Alec Henriksen <[EMAIL PROTECTED]> @ http://alecwh.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor