How do computers generate random numbers?

1

0

How does a computer generate 'random' numbers?

How close to truly 'random' can a number generated by a computer actually be?

Is there software / programming language out that that might generate a more 'truly random' number than others?

ruben_KAI

Posted 2014-10-07T15:02:19.350

Reputation: 89

Question was closed 2014-10-07T15:48:12.253

This question seems borderline off-topic. The second part for sure, is far better suited for StackOverflow than SuperUser. – Ajedi32 – 2014-10-07T15:43:56.013

1

As was commented below, this question How are pseudorandom and truly random numbers different and why does it matter? answers the randomness question very completely.

– heavyd – 2014-10-07T16:21:33.680

Answers

4

Many common implementations of random number generators, are not truly random. Computers typically utilize Pseudorandom Number Generators, which means the computer uses a defined algorithm to generate a sequence of numbers that appear to be random.

In Python you can use the random module to generate pseudorandom numbers. However, if you look at the docs, they include this note:

Warning The pseudo-random generators of this module should not be used for security purposes. Use os.urandom() or SystemRandom if you require a cryptographically secure pseudo-random number generator.

heavyd

Posted 2014-10-07T15:02:19.350

Reputation: 54 755

4@duDE, only half of the question is off-topic. I think the other half is completely on-topic and an interesting question. – heavyd – 2014-10-07T15:14:17.760

1

Related SU question: How are pseudorandom and truly random numbers different and why does it matter?

– Ƭᴇcʜιᴇ007 – 2014-10-07T16:16:13.220