Jump to content

I do not know what is happening


ALine

Recommended Posts

Like we can read in Python documentation:

https://docs.python.org/3/library/random.html

random.seed( value ) initializes random number generator. But if it's not present in code, current time is used, but time is changing all the time.. ;) Different seed, different results from random.randInt()..

So, if you want to have each time the same results, use random.seed( 0 ); at the beginning of script.

It's reverse from C/C++ implementation of random number generator, in which you must execute srand( time() ); manually if you don't want to have exactly the same results.

 

Edited by Sensei
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.