random.html 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <html>
  2. <head>
  3. <title>random</title>
  4. <body bgcolor=#ffffff>
  5. <h2 align=center>random</h2>
  6. <h4 align=center>OS/161 Reference Manual</h4>
  7. <h3>Name</h3>
  8. random - pseudorandom number generation
  9. <h3>Library</h3>
  10. Standard C Library (libc, -lc)
  11. <h3>Synopsis</h3>
  12. #include &lt;stdlib.h&gt;<br>
  13. <br>
  14. long<br>
  15. random(void);<br>
  16. <br>
  17. void<br>
  18. srandom(unsigned long <em>seed</em>);<br>
  19. <h3>Description</h3>
  20. random returns a number between 0 and 0x7fffffff (RAND_MAX). This
  21. number is selected using a rather complex generator which is believed
  22. to generate randomness of an acceptable (though not cryptographic)
  23. quality. Unlike with some generators, all bits of the values returned
  24. are random.
  25. <p>
  26. srandom initializes the generator state based on the passed-in
  27. <em>seed</em>. If srandom is not called, the sequence of numbers
  28. returned by random is the same as if srandom had been called with a
  29. <em>seed</em> of 1.
  30. <p>
  31. The implementation of random and srandom used in OS/161 is software
  32. developed by the University of California, Berkeley and its
  33. contributors.
  34. </body>
  35. </html>