Current location - Quotes Website - Team slogan - Isn't the rand () function generating a real random number?
Isn't the rand () function generating a real random number?
Let me tell you something. Random numbers generated by the rand function are generated according to something called random seeds.

When the random seed is unchanged, the number of rand is unchanged.

Random seed, it has a default value, and we have to change it to achieve real randomness.

Change the function of random seed to srand (), and the parentheses are integers.

Then the real randomness is srand( time( 0))

The time function seems to return the current time.

Because it is always changing, random seeds will never be the same.

Realized real randomness.