in reply to JAPH randomness

Looks like a great JAPH, but it doesn't work on my work laptop. I will try at home later.
This is perl, v5.8.0 built for MSWin32-x86-multi-thread:

∟Nhsk.Mio Pnfowrkajfwfkwg

--
Linux, sci-fi, and Nat Torkington, all at Penguicon 3.0
perl -e 'print(map(chr,(0x4a,0x41,0x50,0x48,0xa)))'

Replies are listed 'Best First'.
Re^2: JAPH randomness
by awwaiid (Friar) on Feb 02, 2005 at 07:17 UTC

    So the issue, as I mentioned previously, is whether your perl and my perl have the same random number generator. Heres one way to check:

    perl -e 'srand(0);print rand(100)."\n"'

    When I run this I get 17.082803610629. What do you get?

    Let us know if it works at home! :)

      I get 0.115966796875 on my laptop. I forgot to try at home.
      So let me get this straight... We can "initialize" the random number generator such that the numbers are not random whatsoever, but rather completely predictable? Very interesting.


      --
      Linux, sci-fi, and Nat Torkington, all at Penguicon 3.0
      perl -e 'print(map(chr,(0x4a,0x41,0x50,0x48,0xa)))'

        *BIG SMILE*

        Welcome, my friend, to the world of pseudo-random number generators! One of the best things about computers is that they are (supposed to be) deterministic; so random number generators are based on neat mathematical equations which appear random to an observer. You start with a seed, and then each number generated is based on the number(s) which have already been generated, going back to the seed.

        Now, not all of these pseudo-random number generator algorithms are as "random" as others (see Knuth's work for example). Not long ago I had a Commodore-128 on which I was doing some lottery simulations and statistics to see if I could predict the lottery. I got stunningly good results... but as it turns out it was a weakness in the built-in random-number generating algorithm, not a weakness in the lottery :)

        In any case, one thing that most of the pseudo-random number generators have in common is the seed. You give it the same seed, you get the same sequence of random numbers. All sorts of fun follow that. If you don't specify the seed one is created for you, based off of timing-based things like the clock and the PIDs and things like that (see function srand)

        Our pseudo-random number generating days are most certainly limited, however. Hardware-based random number generators are increasingly innexpensive, and I doubt it will take long before all devices which need a random-number (all desktops for example) have one built-in. These are based on random numbers generated from physics... sort of the opposite of the timing accuracy of your quartz watch. Some are even based on magical quantum physics stuff...

        I love living in the future!