49 lines
1.2 KiB
HTML
49 lines
1.2 KiB
HTML
<html>
|
|
<head>
|
|
<title>Blitz3D Docs</title>
|
|
<link rel=stylesheet href=../css/commands.css type=text/css>
|
|
</head>
|
|
<body>
|
|
<h1>Rand ([low value],high value)</h1>
|
|
<h1>Parameters</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
low value = optional - defaults to 1; lowest number to generate
|
|
<br />
|
|
high value = highest number to generate
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1>Description</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
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 />
|
|
|
|
<br />
|
|
If you need to generate floating point random numbers, use Rnd.
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1><a href=../2d_examples/Rand.bb>Example</a></h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
; Rand example
|
|
<br />
|
|
|
|
<br />
|
|
; Set the randomizer seed for more true random numbers
|
|
<br />
|
|
SeedRnd (MilliSecs())
|
|
<br />
|
|
|
|
<br />
|
|
; Generate random numbers between 1 and 100
|
|
<br />
|
|
For t = 1 To 20
|
|
<br />
|
|
Print Rand(1,100)
|
|
<br />
|
|
Next
|
|
<br />
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<a target=_top href=../index.htm>Index</a><br>
|
|
<br>
|
|
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>
|
|
</html>
|