Stories
Slash Boxes
Comments

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 17 submissions in the queue.
posted by Fnord666 on Tuesday March 14 2017, @03:04PM   Printer-friendly
from the 42-of-course dept.

Arthur T Knackerbracket has found the following story:

"As an instrument for selecting at random, I have found nothing superior to dice," wrote statistician Francis Galton in an 1890 issue of Nature. "When they are shaken and tossed in a basket, they hurtle so variously against one another and against the ribs of the basket-work that they tumble wildly about, and their positions at the outset afford no perceptible clue to what they will be even after a single good shake and toss."

How can we generate a uniform sequence of random numbers? The randomness so beautifully and abundantly generated by nature has not always been easy to extract and quantify. The oldest known dice (4-sided) were discovered in a 24th century B.C. tomb in the Middle East. More recently, around 1100 B.C. in China, turtle shells were heated with a poker until they cracked at random, and a fortune teller would interpret the cracks. Centuries after that, I Ching hexagrams for fortunetelling were generated with 49 yarrow stalks laid out on a table and divided several times, with results similar to performing coin tosses.

But by the mid-1940s, the modern world demanded a lot more random numbers than dice or yarrow stalks could offer. RAND Corporation created a machine that would generate numbers using a random pulse generator. They ran it for a while and gathered the results into a book titled A Million Random Digits with 100,000 Normal Deviates. What now might seem like an absurd art project was, back then, a breakthrough. For the first time, a nice long sequence of high-quality random numbers was made available to the public. The book was reprinted by RAND in 2001 and is available on Amazon.

A similar machine, ERNIE, built in Bletchley Park in the 1940s for WWII, was reused after the war to generate random numbers for the UK Premium Bond lottery. To quell fears about the fairness and accuracy of ERNIE, the Post Office made a great documentary called The Importance of Being E.R.N.I.E. It's worth a look:

In 1953, randomness was finally formalized into a real computer, the Ferranti Mark 1, which shipped with a built-in random number instruction that could generate 20 random bits at a time using electrical noise. The feature was designed by Alan Turing. Christopher Strachey put it to good use by coding up a randomized love note generator. Here's an sample love note, from David Link's 2009 resurrection of the program:

But Turing's random number instruction was maddening for programmers at the time because it created too much uncertainty in an environment that was already so unpredictable. We expect consistency from our software, but programs that used the instruction could never be run in any consistently repeatable way, which made them nearly impossible to test.

What if a random number generator could be expressed as a deterministic function? What if it could be called repeatedly to deliver a sequence of random numbers, but under the same initial conditions it would always produce the same sequence? Enter the pseudorandom number generator (PRNG).

-- submitted from IRC


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 4, Funny) by GreatAuntAnesthesia on Tuesday March 14 2017, @03:14PM (3 children)

    by GreatAuntAnesthesia (3275) on Tuesday March 14 2017, @03:14PM (#478938) Journal

    Let's get this out of the way: http://dilbert.com/strip/2001-10-25 [dilbert.com]

    • (Score: 3, Funny) by Rivenaleem on Tuesday March 14 2017, @04:09PM (1 child)

      by Rivenaleem (3400) on Tuesday March 14 2017, @04:09PM (#478970)

      https://xkcd.com/221/ [xkcd.com]

      It's even got dice roll in it!

      • (Score: 3, Funny) by driverless on Wednesday March 15 2017, @04:29AM

        by driverless (4770) on Wednesday March 15 2017, @04:29AM (#479278)

        More recently, around 1100 B.C. in China, turtle shells were heated with a poker until they cracked at random, and a fortune teller would interpret the cracks.

        So ancient China had stock market analysts as well?

    • (Score: 1, Informative) by Anonymous Coward on Wednesday March 15 2017, @08:21AM

      by Anonymous Coward on Wednesday March 15 2017, @08:21AM (#479303)

      And related proof that life imitates art https://www.schneier.com/blog/archives/2008/05/random_number_b.html [schneier.com] (debian rng snafu)

  • (Score: 2) by Gaaark on Tuesday March 14 2017, @03:21PM (13 children)

    by Gaaark (41) on Tuesday March 14 2017, @03:21PM (#478942) Journal

    I'm trying to picture 4 sided dice: am I just too tired?

    --
    --- Please remind me if I haven't been civil to you: I'm channeling MDC. ---Gaaark 2.0 ---
    • (Score: 3, Informative) by fadrian on Tuesday March 14 2017, @03:24PM

      by fadrian (3194) on Tuesday March 14 2017, @03:24PM (#478947) Homepage

      Tetrahedral - each side is an equilateral triangle.

      --
      That is all.
    • (Score: 2) by looorg on Tuesday March 14 2017, @03:27PM (3 children)

      by looorg (578) on Tuesday March 14 2017, @03:27PM (#478949)

      Probably to tired. They look like little pyramids or if you like tetrahedrons.

      https://en.wikipedia.org/wiki/Four-sided_die [wikipedia.org]

      • (Score: 2) by darnkitten on Tuesday March 14 2017, @05:57PM (2 children)

        by darnkitten (1912) on Tuesday March 14 2017, @05:57PM (#479016)

        I still have a couple of those yellow caltrops left from my 1st ed. D&D dice sets--the edges and corners wore off all the rest of the dice, but those D4s can still punch a hole in your foot these decades later...

        • (Score: 0) by Anonymous Coward on Tuesday March 14 2017, @06:04PM (1 child)

          by Anonymous Coward on Tuesday March 14 2017, @06:04PM (#479020)

          D4's - my favorite use for them was as caltrops thrown in from of my sister's bedroom door >:-)

          • (Score: 0) by Anonymous Coward on Tuesday March 14 2017, @06:08PM

            by Anonymous Coward on Tuesday March 14 2017, @06:08PM (#479022)

            Er .... that was thrown IN FRONT OF not thrown from ( steps away from keyboard & heads back to coffee maker )......

    • (Score: 3, Funny) by GreatAuntAnesthesia on Tuesday March 14 2017, @03:30PM

      by GreatAuntAnesthesia (3275) on Tuesday March 14 2017, @03:30PM (#478954) Journal

      It's a lot easier if imagine yourself as a flatlander.

    • (Score: 4, Interesting) by VLM on Tuesday March 14 2017, @03:35PM (6 children)

      by VLM (445) on Tuesday March 14 2017, @03:35PM (#478957)

      Gaaark outed as never played DnD.

      You know whats hilarious about D4 is there's D4 with the numbers on the edges and D4 with the numbers on the point and dungeonmaster/gamemasters/wtfmasters will get really pissed off if they're used to one style and a player shows up with the other.

      Point D4 are read as the numbers at the top of the point, the upper half.

      Edge D4 are read as the numbers at the bottom, the bottom half.

      Sometimes you'll see cheap dice that ware whacky like the Chinese printed the digits on a point die upside down.

      Its kinda the emacs/vi argument of the DnD world.

      In practice if the DM/GM/WTF-M gets too whiney you just roll a D8 and divide by 2. Or if it benefits you, forget to divide by 2 LOL.

      • (Score: 2) by bob_super on Tuesday March 14 2017, @05:33PM (5 children)

        by bob_super (1357) on Tuesday March 14 2017, @05:33PM (#479002)

        I've got half a dozen D4, of both types. So do my friends, and in our decades of RPGing, none of us has ever heard of anyone arguing about which type someone should throw.

        Must be a local custom.

        • (Score: 2) by fishybell on Tuesday March 14 2017, @05:58PM (3 children)

          by fishybell (3156) on Tuesday March 14 2017, @05:58PM (#479017)

          The only arguments/complaints I've seen are about barrel dice.

          • (Score: 0) by Anonymous Coward on Tuesday March 14 2017, @07:14PM (2 children)

            by Anonymous Coward on Tuesday March 14 2017, @07:14PM (#479077)

            I'm not familiar with those. Are they the dice you use when doing a barrel roll?

            • (Score: 3, Informative) by AndyTheAbsurd on Tuesday March 14 2017, @07:50PM (1 child)

              by AndyTheAbsurd (3958) on Tuesday March 14 2017, @07:50PM (#479103) Journal

              The wikipedia article on long dice [wikipedia.org] has a decent picture of them. They're definitely a bit confusing the first time you see them.

              --
              Please note my username before responding. You may have been trolled.
              • (Score: 2) by bob_super on Tuesday March 14 2017, @08:01PM

                by bob_super (1357) on Tuesday March 14 2017, @08:01PM (#479108)

                Got some of those, but if they are not perfectly made (balanced), they're useless above 10 sides.

        • (Score: 2) by VLM on Wednesday March 15 2017, @02:09PM

          by VLM (445) on Wednesday March 15 2017, @02:09PM (#479403)

          none of us has ever heard of anyone arguing about which type

          Bob_super outed as never played ... just kidding. Its definitely a rules lawyer thing. Some groups have a house rule, to paraphrase Shakespeare out of context "First we kill all the rules lawyers". I can't argue against that.

          Some folks are really cutthroat and competitive and others just want to have fun while drinking. That's just kinda how it is.

          You have to be realistic that if your group is so doomed in such awful situation that everything depends on some wizard rolling a D4 strength check or a barbarian's D4 int check then you're pretty much doomed and just accept the TPK and move on (total player kill). Unless there's more to the story where its like 4d4+10 or something, another thing to think about if you're rolling 1d4 is you've got a 25% chance of a natural 1 and thats never turning out well, if the situation is so dire it all depends on a 1d4 the only way to possibly make it worse is roll a natural 1.

          Barrel dice look like they would make a good CNC project in my infinite spare time.

  • (Score: 5, Interesting) by VLM on Tuesday March 14 2017, @04:00PM (1 child)

    by VLM (445) on Tuesday March 14 2017, @04:00PM (#478967)

    They miss all the fun apps for PRNGs and CSRNGs

    You can blast a 23 bit register generated pattern down a telecommunications data line thats looped back to detect errors because you know you're sending a specific bit pattern and given the most recently rx bit you can guess the next, and if it doesn't match, count a fail and try to match up again. Syncing is kinda hard if the error rate is really high and there are ways around that such as your modem comparing more than just the last single bit.

    Another funny is your radar can transmit a pulse but its funnier to transmit PRNG AM modulation and then use a computer to demodulate the received signal as that PRNG signal shifted in time and then add up multiple sample and analysis for dramatic performance gain and much harder to jam. Of course if the opfor figures out that you're transmitting a 16 bit prng and they figure your sweep rate and sync up to it they can transmit a fake signal that will appear on their radar as any bit map they want to transmit, and young men being young men, god only knows the bitmaps we sent the Russians in the bad old days.

    To extend the funny above you can have an unjamable digital military radar by using a true RNG or CSRNG and cheap memory to both transmit a signal and store the truly random bit pattern that was transmitted for later demodulation in the receive circuit. The opfor can't predict the pattern you're about to transmit so they can only do gross analog level jamming of just trying to overload, kinda boring and inelegant compared to what happened in the 80s-ish.

    You can do all kinds of weird things with PRNGs assuming they're flat and smooth in an analog sense but in a digital sense they're very predictable. You can "fuzz" a switching power supply to raise the overall noise floor in the output while wiping out the discrete RF noise spikes, this is old news, but the trick is you pick the PRNG so its both random (smooth bandwidth) and predictable (can't generate more than 20 zeros in a row for algorithmic reasons). Also something about injecting noise into a PLL that I don't entirely remember why but same general idea, trade a higher noise floor for reduced individual interference discrete spikes.

    You can also do non-hopping spread spectrum by spreading a RF signal using a PRNG modulation in a mixer, then on the other side syncing up the PRNG to demod the spread spectrum signal. Good luck with the whole "sync the PRNG modulations" it turns out to be kinda non-trivial or more exactly its easy to F up.

    Or so I've heard.

    • (Score: 2) by Techwolf on Wednesday March 15 2017, @03:23AM

      by Techwolf (87) on Wednesday March 15 2017, @03:23AM (#479261)

      Went to mod up and seen its already at +5. Thank you for the informative comment. I learned something today. Its comments like this that makes this site so good. :-)

  • (Score: 4, Interesting) by jdavidb on Tuesday March 14 2017, @04:42PM (6 children)

    by jdavidb (5690) on Tuesday March 14 2017, @04:42PM (#478986) Homepage Journal

    This was really cool and I'm glad it was shared here. The comments so far are great to read, too. And pulling up the book of numbers on Amazon leads to the chance to read some very interesting and funny reviews!

    I actually once printed five pages of random digits off of random.org and saved them for a year using them for various projects that interested me where I might need some random numbers, so I identify with the people who needed this book back in the day.

    Random numbers have always interested me. The first program I remember understanding was a BASIC program printed in National Geographic World kids' magazine that gave you three chances to guess a random number from 1 to 10. For years after that the very first thing I did when checking out a new programming language was to find out how to get random numbers in it.

    --
    ⓋⒶ☮✝🕊 Secession is the right of all sentient beings
    • (Score: 3, Interesting) by darnkitten on Tuesday March 14 2017, @06:13PM (5 children)

      by darnkitten (1912) on Tuesday March 14 2017, @06:13PM (#479029)

      I remember learning the distinction between pseudorandom and random numbers back in my first stone age programming class. I never really understood the need for the former, as my concern was more with programming character generators and combat tables.

      Man...I was so proud of myself when I figured out 4d6, drop the low and arrange, with class modifiers...

      • (Score: 2) by jdavidb on Tuesday March 14 2017, @06:51PM (4 children)

        by jdavidb (5690) on Tuesday March 14 2017, @06:51PM (#479061) Homepage Journal

        I remember learning the distinction between pseudorandom and random numbers back in my first stone age programming class. I never really understood the need for the former, as my concern was more with programming character generators and combat tables.

        I don't remember when I learned the distinction, but it wasn't in a class. I do remember that because I am so obsessive it prompted a bit of a mental crisis for me while I obsessed about getting true randomness and whether or not true randomness truly exists in the universe.

        --
        ⓋⒶ☮✝🕊 Secession is the right of all sentient beings
        • (Score: 2) by darnkitten on Tuesday March 14 2017, @08:40PM (3 children)

          by darnkitten (1912) on Tuesday March 14 2017, @08:40PM (#479121)

          Looking back on it, I am forced to wonder how that poor TRS-80 determined "true random" numbers, given the difficulty of generating truly random numbers and the limitations of the hardware and software of the time..

          (Just looked it up--apparently the function returned a "more-or-less random" value based on the state of the refresh register).

          • (Score: 3, Informative) by jdavidb on Wednesday March 15 2017, @12:39AM

            by jdavidb (5690) on Wednesday March 15 2017, @12:39AM (#479220) Homepage Journal

            I had the same experience wondering about how the NES generated random numbers and how its generator was seeded without a clock to use as a seed. It finally dawned on me that some kind of timing since startup was going on, and in fact framecounting seems to have been a common solution. There's an NES game I tended to obsess over that I still pull out once or twice a year and play in emulation, and there's one particular value in it that is crucial to the game that varies from 1 to 5, with 5 being the rarest, and I've finally become convinced that essentially there's some kind of sinusoidal variation computed from the frame count and in fact you can time and predict the value with a decent level of predictability.

            Good grief I just exposed the depraved depths of my nerdish obsessive insanity when it comes to random numbers.

            --
            ⓋⒶ☮✝🕊 Secession is the right of all sentient beings
          • (Score: 3, Informative) by VLM on Wednesday March 15 2017, @02:24PM (1 child)

            by VLM (445) on Wednesday March 15 2017, @02:24PM (#479414)

            Its still a "thing" a couple weeks ago I was trying to use a ESP8266 (basically a microcontroller that is a wifi, or a wifi that is a microcontroller, kinda) to send MQTT data and I had the bright idea of using the random number function in micropython (which runs on a ESP8266 and is pretty much what it sounds like) to generate random looking data to send, and every time I run it my "random" data is the exact same pattern and I'm fighting my old nemesis from 80s home computer BASIC again. If I hadn't known about PRNGs I'd probably have tried to troubleshoot why the buffer keeps re-importing the same data no matter how many times I reset the blasted thing.

            Many TRS80s had RTC also. Its not fun world for a modern microcontroller. No battery backed up RTC so I can't seed the PRNG with the timestamp. Static memory so no refresh register to sniff. DHCP gives it the same address every time. They are almost purely predictable functional devices hit reset and the same thing happens every time. I could implement NTP to use the returned time as a seed but the whole point of using random data was keeping it ultra simple so I can debug the MQTT side not the data acquisition side. Ironically other than being offensively predictable the completely non-random RNG was good enough to set the output side MQTT stuff working.

            So yeah even in 2017 there are still contemporary systems where rand() outputs the same pattern every time you reset the system.

            • (Score: 2) by jdavidb on Friday March 17 2017, @01:28AM

              by jdavidb (5690) on Friday March 17 2017, @01:28AM (#480135) Homepage Journal

              Many TRS80s had RTC also. Its not fun world for a modern microcontroller. No battery backed up RTC so I can't seed the PRNG with the timestamp

              I remember discovering on my Apple IIGs (which did have a battery backed clock) that if I booted from a floppy with the OS on it, my BASIC random numbers were not predictable, but if I just booted to a BASIC prompt on bare hardware, the random numbers were the same every time. That was long before I understood about random number seeds, and it mystified me. Now I'm still a little bit mystified that the OS knew to seed the BASIC random number generator but the firmware did not. It was the same BASIC, I think - built into firmware.

              --
              ⓋⒶ☮✝🕊 Secession is the right of all sentient beings
  • (Score: 4, Informative) by DeathMonkey on Tuesday March 14 2017, @05:40PM (1 child)

    by DeathMonkey (1380) on Tuesday March 14 2017, @05:40PM (#479008) Journal

    Build your own, if you're into that kind of thing. [makezine.com]

    Sounds pretty similar to Turing's device though I read the article a while ago and only re-skimmed it now...

  • (Score: 3, Informative) by wonkey_monkey on Tuesday March 14 2017, @06:56PM

    by wonkey_monkey (279) on Tuesday March 14 2017, @06:56PM (#479064) Homepage

    It's worth a look:

    What is? There's a colon but nothing to look at...

    Here's an sample love note, from David Link's 2009 resurrection of the program:

    Where?

    --
    systemd is Roko's Basilisk
  • (Score: 4, Funny) by Thexalon on Tuesday March 14 2017, @07:55PM

    by Thexalon (636) on Tuesday March 14 2017, @07:55PM (#479105)

    I remember a professor back in uni describing random number generation, and bringing up the book A Million Random Digits with 100,000 Normal Deviates. As he described it, not the most fascinating read, except for one racy part that reads "696969 74".

    --
    The only thing that stops a bad guy with a compiler is a good guy with a compiler.
  • (Score: 2) by darkfeline on Tuesday March 14 2017, @09:54PM

    by darkfeline (1030) on Tuesday March 14 2017, @09:54PM (#479156) Homepage

    I'm pretty the motivation and common use case for PRNG isn't to reproduce "randomness" for testing, but rather to supply enough good randomness (potentially cryptographically secure) out of the small amount of "real" randomness available to most computing devices.

    Cool fact: /dev/urandom and /dev/random on modern Linux are both hooked up to the same CSPRNG, the difference is reads on /dev/random will block if an internal "entropy gauge" hits zero. This "entropy gauge" generally has no significance, so you should always use /dev/urandom.

    --
    Join the SDF Public Access UNIX System today!
  • (Score: 2) by FatPhil on Wednesday March 15 2017, @08:29AM

    by FatPhil (863) <pc-soylentNO@SPAMasdf.fi> on Wednesday March 15 2017, @08:29AM (#479306) Homepage
    Is how bad RAND's numbers are. They're, by dumbass design, missing 50 bits of entropy. OK, that's only a fraction of a percent loss, but there was no reason for them to be so sloppy. Basically they attempted to unbias the numbers from their source by summing consecutive numbers in each column, and did it cyclically (which means the sum of each column must be even, hence the missing bit of entropy), rather than by using one extra row of input. There was also no reason to do it per column, they could have done it cyclically over the whole set, thus dropping only one bit in total (a bit which could have been put back by a single coin-toss-based toggle at the end). But still, it's the principle of the thing - they had one job, the numbers should have been perfect, perfection was possible, and they screwed up.

    The fact that their actual source numbers needed unbiasing implies that there's possible still some residual bias, summing pairs is a far from perfect unbiaser. Perfect unbiasers existed at the time - yet again, more sloppiness.
    --
    Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves
(1)