how do random numbers on computers work?

1.43K views

For example, is there a formula for a random number?

In: 47

75 Answers

1 2 3 7 8
Anonymous 0 Comments

Most computer applications use what is known as psudo random numbers. That is what you describe. There are a number of formulas which can generate an endless stream of what looks like random numbers. But of course they are not completely random as if you know the number it starts with or can guess this you can determine what the entire stream of numbers will be. But for most purposes this is enough.

True random numbers is a big problem for a computer. A lot of times you can gather random numbers by looking at the timings for the inputs, for example keyboard presses, mouse movements, network traffic and disk timing. If you take all these numbers and feed them into an algorithm which scrambles them together you get something which is very hard to guess.

For servers, virtual machines and various embedded devices this is hard though as they might not have much inputs, or even worse they might have predictable inputs. A common trick is to use the different timings from the two clocks in the computer. Most computers have one clock to keep track of time over hours, days and months and another to keep track of the timings of the signals in milliseconds, microseconds and even nanoseconds. And even though these are kept in sync with each other they are not perfectly aligned. So it is impossible to say for example who will count to a millisecond first when you start them the same time. This gives you some random numbers which can be used by the computer.

But it is becoming more and more common for computers to come with dedicated random number generator hardware. These contain a tiny bit of radioactive material, just a fraction of what your fire alarm contain, and then measures the random radioactive decay from this which it transforms into a stream of random numbers. There are other techniques which requires even less radioactive material but these are considered less secure. The random number generators often come included with the encryption module that is the trusted platform module.

Anonymous 0 Comments

Yes, basically. What you usually use on a computer is called a pseudorandom number. You have an equation that produces unpredictable results from 0 to 1, and you feed it a seed number (often the current time, or the output of your last random number). This is *good enough* for most purposes, and has the advantage that if you need to test something you can use the same seed number and get repeatable results.

If you need a genuinely random number, you use a [hardware random number generator](https://en.wikipedia.org/wiki/Hardware_random_number_generator). These basically measure something unpredictable about the physical world, and use that measurement as the random number. For example, you could use a radio antenna to take a sample of static. Or, [Cloudflare uses a webcam pointed at a bank of 100 lava lamps](https://www.cloudflare.com/learning/ssl/lava-lamp-encryption/).

Anonymous 0 Comments

Most computer applications use what is known as psudo random numbers. That is what you describe. There are a number of formulas which can generate an endless stream of what looks like random numbers. But of course they are not completely random as if you know the number it starts with or can guess this you can determine what the entire stream of numbers will be. But for most purposes this is enough.

True random numbers is a big problem for a computer. A lot of times you can gather random numbers by looking at the timings for the inputs, for example keyboard presses, mouse movements, network traffic and disk timing. If you take all these numbers and feed them into an algorithm which scrambles them together you get something which is very hard to guess.

For servers, virtual machines and various embedded devices this is hard though as they might not have much inputs, or even worse they might have predictable inputs. A common trick is to use the different timings from the two clocks in the computer. Most computers have one clock to keep track of time over hours, days and months and another to keep track of the timings of the signals in milliseconds, microseconds and even nanoseconds. And even though these are kept in sync with each other they are not perfectly aligned. So it is impossible to say for example who will count to a millisecond first when you start them the same time. This gives you some random numbers which can be used by the computer.

But it is becoming more and more common for computers to come with dedicated random number generator hardware. These contain a tiny bit of radioactive material, just a fraction of what your fire alarm contain, and then measures the random radioactive decay from this which it transforms into a stream of random numbers. There are other techniques which requires even less radioactive material but these are considered less secure. The random number generators often come included with the encryption module that is the trusted platform module.

Anonymous 0 Comments

Most computer applications use what is known as psudo random numbers. That is what you describe. There are a number of formulas which can generate an endless stream of what looks like random numbers. But of course they are not completely random as if you know the number it starts with or can guess this you can determine what the entire stream of numbers will be. But for most purposes this is enough.

True random numbers is a big problem for a computer. A lot of times you can gather random numbers by looking at the timings for the inputs, for example keyboard presses, mouse movements, network traffic and disk timing. If you take all these numbers and feed them into an algorithm which scrambles them together you get something which is very hard to guess.

For servers, virtual machines and various embedded devices this is hard though as they might not have much inputs, or even worse they might have predictable inputs. A common trick is to use the different timings from the two clocks in the computer. Most computers have one clock to keep track of time over hours, days and months and another to keep track of the timings of the signals in milliseconds, microseconds and even nanoseconds. And even though these are kept in sync with each other they are not perfectly aligned. So it is impossible to say for example who will count to a millisecond first when you start them the same time. This gives you some random numbers which can be used by the computer.

But it is becoming more and more common for computers to come with dedicated random number generator hardware. These contain a tiny bit of radioactive material, just a fraction of what your fire alarm contain, and then measures the random radioactive decay from this which it transforms into a stream of random numbers. There are other techniques which requires even less radioactive material but these are considered less secure. The random number generators often come included with the encryption module that is the trusted platform module.

Anonymous 0 Comments

Yes, basically. What you usually use on a computer is called a pseudorandom number. You have an equation that produces unpredictable results from 0 to 1, and you feed it a seed number (often the current time, or the output of your last random number). This is *good enough* for most purposes, and has the advantage that if you need to test something you can use the same seed number and get repeatable results.

If you need a genuinely random number, you use a [hardware random number generator](https://en.wikipedia.org/wiki/Hardware_random_number_generator). These basically measure something unpredictable about the physical world, and use that measurement as the random number. For example, you could use a radio antenna to take a sample of static. Or, [Cloudflare uses a webcam pointed at a bank of 100 lava lamps](https://www.cloudflare.com/learning/ssl/lava-lamp-encryption/).

Anonymous 0 Comments

>is there a formula for a random number?

There are many.
These formulas are known as Pseudorandom Number Generators(PRNG).
They always take in a number called a “seed” and then do math at it till it spits out seemingly random numbers.
Though a side effect of this is that if you use the same formula on the same seed, you get the same stream of seemingly random numbers.

They vary on how close to random it is, how hard it is to guess the seed given some example of the stream, and how hard it is for a computer to run.

Sometimes though they need real random numbers.
So to do that usually they need a piece of hardware that measures something physical to make up random number generators.
Random.org has some radio stuff to see what kinda random noise is coming from the atmosphere.
Cloudflare has a camera pointed to a wall of lava lamps and makes numbers from the photos.
Others use quantum mechanics stuff and other weird things.

Often these numbers will be fed into PRNG as the seed to make it even more random incase the physics stuff is somehow a little more predictable that moment.

Anonymous 0 Comments

Two ways: a pseudo random number generator (which is predictable from a given seed point) or a number generated from a generally unknown but measurable value, e.g. CPU temperature at any given point in time. Both are not truly random in the general sense, but are random ‘enough’ for day to day applications.

Anonymous 0 Comments

Yes, basically. What you usually use on a computer is called a pseudorandom number. You have an equation that produces unpredictable results from 0 to 1, and you feed it a seed number (often the current time, or the output of your last random number). This is *good enough* for most purposes, and has the advantage that if you need to test something you can use the same seed number and get repeatable results.

If you need a genuinely random number, you use a [hardware random number generator](https://en.wikipedia.org/wiki/Hardware_random_number_generator). These basically measure something unpredictable about the physical world, and use that measurement as the random number. For example, you could use a radio antenna to take a sample of static. Or, [Cloudflare uses a webcam pointed at a bank of 100 lava lamps](https://www.cloudflare.com/learning/ssl/lava-lamp-encryption/).

Anonymous 0 Comments

There is “random” which uses the internal clock to generate a random number which is different almost every time regardless of seed, and then there is “procedural noise” which generates a random looking waveform based on any given set of seeds, and will reproduce the same result give the same seed.

Anonymous 0 Comments

>is there a formula for a random number?

There are many.
These formulas are known as Pseudorandom Number Generators(PRNG).
They always take in a number called a “seed” and then do math at it till it spits out seemingly random numbers.
Though a side effect of this is that if you use the same formula on the same seed, you get the same stream of seemingly random numbers.

They vary on how close to random it is, how hard it is to guess the seed given some example of the stream, and how hard it is for a computer to run.

Sometimes though they need real random numbers.
So to do that usually they need a piece of hardware that measures something physical to make up random number generators.
Random.org has some radio stuff to see what kinda random noise is coming from the atmosphere.
Cloudflare has a camera pointed to a wall of lava lamps and makes numbers from the photos.
Others use quantum mechanics stuff and other weird things.

Often these numbers will be fed into PRNG as the seed to make it even more random incase the physics stuff is somehow a little more predictable that moment.

1 2 3 7 8