Random Numbers

Raheelanjum
4 min readDec 3, 2024

Random numbers on a computer are not really random. They are a sequence of "pseudo" random numbers.

Random Numbers on a Computer

First off, it is not really possible (nor desirable) to have real random numbers. What we want is a repeatable sequence of seemingly random numbers that satisfy certain properties, such as the average value of a list of random numbers between, say, 0 and 1000, should be 500. Other properties, such as no (predictable) relation between the current random number and the next random number, are desirable. In any program where random values are necessary (for example, most simulations), the programming language must provide us with a random number generator. This will be a function that will, when called, provide us with a single random number... when called again, provide us with another random number.

"Pseudo" random number sequences

Generating a single random number is easy. 27. There!Generating a sequence of random numbers is quite difficult because we want certain assumptions about this sequence to be true!Note that "random" number generators produce what are called "pseudo" random numbers, meaning that the numbers only "approximate" real randomness. Some Goals:Repeatable: Why?Speed (Fast to Compute): Why?Average value is the average of a range. Odd followed by an Even is as…

--

--

Raheelanjum
Raheelanjum

Written by Raheelanjum

Highly skilled and experienced content writer dedicated to crafting compelling, informative content that resonates with diverse audiences. Expertise spans blog

Responses (13)