English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How does the random function work?

A program is a set of instructions that tells the computer exactly what to do, and the computer isn't capable of doing anything on it's own, yet asking it for a random number it's like asking it to make it's own decision.

2006-09-17 06:06:57 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

A program, or rather the computer itself, is can't actually do this. It basically tries to trick you into thinking it can. What it actually does is take a specific date, something like January 1st 1980 or something similar depending on the language and platform, counts the number of seconds that have past since that date than does a sequence of match computations on it until it gets a number less then or equal to 1.

If you were to right a program to have the computer plot random points on the screen you would quickly see a repeating pattern in it.

2006-09-17 06:13:48 · answer #1 · answered by jm3technologies 2 · 1 0

You are correct. Without access to some sort of noise source, a computer can't generate a truly random number. Instead, computer programs use an algorithm to generate a "pseudorandom" number. Pseudorandom numbers are randomly distributed, and so suffice for most purposes.

2006-09-17 07:09:53 · answer #2 · answered by injanier 7 · 0 0

:]

2006-09-17 06:08:25 · answer #3 · answered by Justine B 1 · 0 0

fedest.com, questions and answers