Rand.htm 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>Rand ([low value],high value)</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. low value = optional - defaults to 1; lowest number to generate <br />
  13. high value = highest number to generate
  14. </td>
  15. </tr>
  16. </table>
  17. <h1>Description</h1>
  18. <table>
  19. <tr>
  20. <td>
  21. Unlike the RND command, this command actually returns only integer values. The low value defaults to 1 if no value is specified. The high value is the highest number that can be randomly generated. <br />
  22. <br />
  23. If you need to generate floating point random numbers, use Rnd.
  24. </td>
  25. </tr>
  26. </table>
  27. <h1><a href=../2d_examples/Rand.bb>Example</a></h1>
  28. <table>
  29. <tr>
  30. <td>
  31. ; Rand example <br />
  32. <br />
  33. ; Set the randomizer seed for more true random numbers <br />
  34. SeedRnd (MilliSecs()) <br />
  35. <br />
  36. ; Generate random numbers between 1 and 100 <br />
  37. For t = 1 To 20 <br />
  38. Print Rand(1,100) <br />
  39. Next <br />
  40. </td>
  41. </tr>
  42. </table>
  43. <br>
  44. <a target=_top href=../index.htm>Index</a><br>
  45. <br>
  46. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=Rand&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  47. </html>