# Random number - really?

**URL:** <https://boards.straightdope.com/t/random-number-really/62240>\
**Category:** Factual Questions\
**Created:** [April 17, 2001, 3:38am UTC](https://boards.straightdope.com/t/random-number-really/62240 "2001-04-17T03:38:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![LifeWillFall](https://avatars.discourse-cdn.com/v4/letter/l/46a35a/32.png) [@LifeWillFall](https://boards.straightdope.com/u/LifeWillFall)\
**Post date:** [April 17, 2001, 3:38am UTC](https://boards.straightdope.com/t/random-number-really/62240/1 "2001-04-17T03:38:09Z")

</div>

I was reading through this thread

[http://boards.straightdope.com/sdmb/showthread.php?threadid=67315](http://boards.straightdope.com/sdmb/showthread.php?threadid=67315)

and it rekindled a question I should have asked in my C++ class but I was wonder just how someone goes about programming a computer to come up with a truly random number? I’m not looking for code here just the idea?

---

<div class="post-metadata">

**Author:** ![fecal\_nugget](https://avatars.discourse-cdn.com/v4/letter/f/b38774/32.png) [@fecal\_nugget](https://boards.straightdope.com/u/fecal_nugget)\
**Post date:** [April 17, 2001, 3:53am UTC](https://boards.straightdope.com/t/random-number-really/62240/2 "2001-04-17T03:53:53Z")

</div>

The only way for a computer to end up with a truly random number, is to get a starting number from elsewhere. For this reason, some random number generators (e.g., encryption programs) will ask you to move the mouse or randomly tap the keys before starting an algorithm. The string of information is transformed (or rather, not transformed, but I’m not splitting hairs) into a sequence of numbers which is used as the starting number for an algorithm.

---

<div class="post-metadata">

**Author:** ![Drastic](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@Drastic](https://boards.straightdope.com/u/Drastic)\
**Post date:** [April 17, 2001, 9:53am UTC](https://boards.straightdope.com/t/random-number-really/62240/3 "2001-04-17T09:53:08Z")

</div>

The random numbers generated by computers are often called “pseudorandom” because, technically speaking, they’re not “true random”. Essentially because they will always produce them by taking an initial seed value, performing an algorithm on it to alter it, and producing a “random” value as the end result.

So the thing is, if you know exactly what algorithm it uses and know the seed value, you know what the result’s going to be–thus, not random.

Practically speaking, though, tricks can be done to make that seed value very hard to figure out, and conceivably impossible to I suppose. An idea I’ve heard in a similar discussion elsewhere would be to take as a seed value the current effect of background radio noise on, say, the sound card’s mike jack. The result is still pseudorandom, but that distinction’s only academic as the seed value comes from so many factors that it’s psuedorandom only in the sense of the proverbial butterfly-causing-a-hurricane sense.

---

<div class="post-metadata">

**Author:** ![AHunter3](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ahunter3/32/368_2.png) [@AHunter3](https://boards.straightdope.com/u/AHunter3)\
**Post date:** [April 17, 2001, 12:08pm UTC](https://boards.straightdope.com/t/random-number-really/62240/4 "2001-04-17T12:08:41Z")

</div>

I don’t know about C++, but when I need a random number in FileMaker I use some variation on

Mod(Status(currenttime), 10)

That gives the last digit of the current time.

If I needed more than 10 possible digits, I’d use

Mod(Status(currenttime), 100)

---

<div class="post-metadata">

**Author:** ![Terminus\_Est](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/terminus_est/32/3087_2.png) [@Terminus\_Est](https://boards.straightdope.com/u/Terminus_Est)\
**Post date:** [April 17, 2001, 2:20pm UTC](https://boards.straightdope.com/t/random-number-really/62240/5 "2001-04-17T14:20:11Z")

</div>

What **Drastic** said.

To get truly random numbers, you’ll have to hook up your computer to an external randomizer, like a [lava lamp](http://lavarand.sgi.com/).

> [@](#):
>
> Q1.1: What is lavarand?
> 
> Lavarand is a system by which a pseudo-random number generator is seeded by cryptographic hash of the digital output of a photograph of six Lava Lite® lamps.
> 
> Q1.2: Um…huh?
> 
> A digital camera takes a picture of some Lava Lite lamps, the digital output of that image is fed into various number mungers and kablam! you have a bona fide random number.

---

<div class="post-metadata">

**Author:** ![Ethilrist](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ethilrist/32/4604_2.png) [@Ethilrist](https://boards.straightdope.com/u/Ethilrist)\
**Post date:** [April 17, 2001, 2:43pm UTC](https://boards.straightdope.com/t/random-number-really/62240/6 "2001-04-17T14:43:31Z")

</div>

You kids and your lava lamps! Why, when I was a boy, if we needed a random number, we rolled dice! They only had six sides, and we were glad to have them! Hmmph.

Okay, we had lava lamps too, but we just looked at them.

---

<div class="post-metadata">

**Author:** ![erislover](https://avatars.discourse-cdn.com/v4/letter/e/71e660/32.png) [@erislover](https://boards.straightdope.com/u/erislover)\
**Post date:** [April 17, 2001, 6:00pm UTC](https://boards.straightdope.com/t/random-number-really/62240/7 "2001-04-17T18:00:58Z")

</div>

In Great Debates we’ve hashed over whether or not random numbers actually exist. The consensus, IMO, was that no, they don’t, though they may (heh). That isn’t to say we can predict the next number, however, just that it is predictable _in theory_ (probably).  
[http://boards.straightdope.com/sdmb/showthread.php?threadid=22248](http://boards.straightdope.com/sdmb/showthread.php?threadid=22248)  
[http://boards.straightdope.com/sdmb/showthread.php?threadid=51063](http://boards.straightdope.com/sdmb/showthread.php?threadid=51063)
