How the random function is built (in Python for example)?


#1

Hi :slight_smile:

Here’s the code academy introduction of data science which makes me wonder about how to code ramdomness

it seems an pretty interesting question to my mind.

I’m newbie and i do not know a lot about maths, so if you want to respond with an equation, please explain it with words too.

Thanks for enlightning my mind !


#2

I find this interesting article :
https://www.howtogeek.com/183051/htg-explains-how-computers-generate-random-numbers/
The article explains that computers can generate true random numbers or pseudorandom numbers.

In the exercise above, when we call random.choice(months) in Python, does the computer generates true random numbers or pseudorandom numbers ?


#3

The random module classes generate pseudo-random numbers.

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.
https://docs.python.org/2/library/random.html