How to generate a random number in C? -


Is there a function to generate random numbers in C? Or do I have to use a third party library?

note : for security rand ( ) Do not use if you need a cryptographically safe number, instead.

  #include & lt; Time.h> # Include & lt; Stdlib.h & gt; Srand (time (zero)); // should only be called int r = rand (); Pseudo random integer between // 0 and RAND_MAX  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -