PDA

View Full Version : Random Number Generation



drdroid
08-01-2003, 08:10 AM
I'm just curious... I know there are already alot of random number generating functions. But when I think about it, it doesn't seem plausable for any program to be random. Seriously out of curiosity, if you were a programmer in the 70's-80's without any idea of how to randomnize, how would you do it? (btw, i know it didn't actually, but in this timeframe c++ exists :p )

Prelude
08-01-2003, 08:32 AM
>if you were a programmer in the 70's-80's without any idea of how to randomnize, how would you do it?
I'd fake it, just like now. :)

FillYourBrain
08-01-2003, 08:35 AM
prelude, re-phase that. I almost choked on my coffee.

Prelude
08-01-2003, 08:38 AM
>prelude, re-phase that. I almost choked on my coffee.
:rolleyes: :eek: :p :D
I would calculate a pseudo-random sequence using a seed supplied by the client code.

p.s. That's really not much better if you read into it. Anyway, you should know not to drink anything while reading these forums. ;)

drdroid
08-01-2003, 08:39 AM
>if you were a programmer in the 70's-80's without any idea of how to randomnize, how would you do it?
I'd fake it, just like now.
prelude, re-phase that. I almost choked on my coffee.

LMFAO

adrianxw
08-01-2003, 09:10 AM
>>>
if you were a programmer in the 70's-80's without any idea of how to randomnize, how would you do it?
<<<

Cheeky git. What do you mean "had no idea"? Believe it or not, in the 70's and 80's we used exactly the same pseudo-random number genrating techniques as are used today.

drdroid
08-01-2003, 09:16 AM
>>>
if you were a programmer in the 70's-80's without any idea of how to randomnize, how would you do it?
<<<

Cheeky git. What do you mean "had no idea"? Believe it or not, in the 70's and 80's we used exactly the same pseudo-random number genrating techniques as are used today.


What I meant by that was being a programmer, with limited access to resources, like the boards, websites, boooks etc.

adrianxw
08-01-2003, 09:18 AM
Books had been invented then. One such was the manual for your compiler. In those days, when there weren't as many "quick fix" resources, people RTFM and solved their own problems, a skill that seems lost today.

Perspective
08-01-2003, 09:22 AM
you could also consult that book published in the '60s by the RAND corp. Its this book of 1,000,000 random numbers.

ill try and find a link, they have it at my uni's library

drdroid
08-01-2003, 09:25 AM
ok, we're getting off topic here... i'm just asking how you would do it, with only the basic programming information resources.

edit: otherwise known as how do you make fire with two rocks if your living in the wild. :confused:

FillYourBrain
08-01-2003, 09:27 AM
droid, I think the idea is already there. You have to "fake it" :D. Fake randomness with whatever you have available to you. System clock provides you with a number that's always changing so many people used that in addition to other numbers they could pull from various places.

adrianxw
08-01-2003, 09:29 AM
>>> i'm just asking how you would do it,

I've told you how I did do it! I have been programming since 1978 after all.

Brian
08-01-2003, 09:35 AM
Here's a random number generator written in assembly. (don't be deceived by the extension). Might give you an idea of how random number generation works.

sean
08-01-2003, 09:56 AM
An example is Solitaire. Most MS version use random numbers based on the system clock. If you press F2 repeatedly in rapid succession, the same game apperas for a second at a time. I would do the exact same thing.

Stoned_Coder
08-01-2003, 10:01 AM
For non-cryptography applications Mersenne Twister random number generator is fast,powerful and has an incredibly huge period. There is C code available on the web and a c++ wrapper should take about 15 minutes to write.
Boost has several PRNG's now and mersenne twister is one of them. Check it out.

joshdick
08-01-2003, 02:15 PM
I vaguely remember reading an article in a slashdot newsletter about a new way to generate random numbers. The computer took input from some sort of ambient energy form within the computer (something like radio signals or electromagnetic fields or some such thing no one notices in small quantities). The article said that the numbers generated from this passed several tests or true randomness.

If I had more time, I might search for a link for y'all, but I have to get ready for work now. I know I read that article in a Slashdot newsletter within the last year. Maybe someone else can find information on it.

adrianxw
08-01-2003, 02:26 PM
>>>
The computer took input from some sort of ambient energy form within the computer
<<<

I'd read a story, a while back, about an generator which read things like CPU temperature, fan speeds and other available values from the system and used these in the derivation process. It produced a pseudo-random sequence that was very significantly more random than the normal fast algorithm, but had not been judged to be totally random, (the shortcomings are obvious).

Ken Fitlike
08-01-2003, 02:59 PM
Originally posted by adrianxw
>>>
The computer took input from some sort of ambient energy form within the computer
<<<

I'd read a story, a while back, about an generator which read things like CPU temperature, fan speeds and other available values from the system and used these in the derivation process. It produced a pseudo-random sequence that was very significantly more random than the normal fast algorithm, but had not been judged to be totally random, (the shortcomings are obvious).

I've come across references to entropy pooling where the system uses (arguably) truly random input from the user, such as mouse movements or keypresses, in order to generate a 'system entropy pool'. This data can then be used as required to generate security/encryption keys or random numbers.

sean
08-01-2003, 03:21 PM
Well if you really think about it, not even humans can come up with truly random numbers.

Clyde
08-01-2003, 03:27 PM
Quantum systems would do it.

sean
08-01-2003, 03:28 PM
"Well Quantum Systems would do it"

adrianxw
08-02-2003, 03:35 AM
Actually, with the talk of the "olden days", it was common practice back then for systems requiring true random numbers, (lottery systems for example), to have either a "noise diode" or a radioactive isotope counter, i.e. physical devices, for generating random numbers.

>>> generate a 'system entropy pool'.

I can see that having at least some of the same shortcomings I alluded to before. Certain keys are used more than others, certain areas of the screen as well, (i.e. menus tend to be at the top).

However, I can well see that this would be an improvement over the current pseudo-random algorithms commonly used.