1 |
<html> |
2 |
<head> |
3 |
<meta name="author" content="Christian Schoenebeck"> |
4 |
<title>random() function</title> |
5 |
<meta name="description" content="Random number generator function."> |
6 |
</head> |
7 |
<body> |
8 |
<h1>random()</h1> |
9 |
<p> |
10 |
Provides a pseudo random number generator. Each time this function |
11 |
is called, another random number will be returned. |
12 |
</p> |
13 |
|
14 |
<h3>Function Prototype</h3> |
15 |
<p/> |
16 |
<code lang="nksp"> |
17 |
random(??minimum??, ??maximum??) |
18 |
</code> |
19 |
|
20 |
<h3>Arguments</h3> |
21 |
<table> |
22 |
<tr> |
23 |
<th>Argument Name</th> <th>Data Type</th> <th>Description</th> |
24 |
</tr> |
25 |
<tr> |
26 |
<td><code>??minimum??</code></td> |
27 |
<td>Integer Number or<br> |
28 |
Real Number</td> |
29 |
<td>The smallest number of allowed value range (including this value).<br> |
30 |
[required]</td> |
31 |
</tr> |
32 |
<tr> |
33 |
<td><code>??maximum??</code></td> |
34 |
<td>Integer Number or<br> |
35 |
Real Number</td> |
36 |
<td>The highest number of allowed value range (including this value).<br> |
37 |
[required]</td> |
38 |
</tr> |
39 |
</table> |
40 |
|
41 |
<h3>Return Value</h3> |
42 |
<table> |
43 |
<tr> |
44 |
<th>Data Type</th> |
45 |
<th>Description</th> |
46 |
</tr> |
47 |
<tr> |
48 |
<td>Integer Number</td> |
49 |
<td>Next random number within the requested value range.</td> |
50 |
</tr> |
51 |
</table> |
52 |
|
53 |
<h3>Remarks</h3> |
54 |
<p> |
55 |
This functions accepts any standard unit and finalness for its two arguments. |
56 |
However the unit types of the two arguments must be identical. |
57 |
The return value's unit type is identical to the two passed arguments' one, |
58 |
and the return value's finalness is the case if at least one of the two arguments |
59 |
has finalness. |
60 |
</p> |
61 |
|
62 |
<h3>Examples</h3> |
63 |
<p/> |
64 |
<code> |
65 |
on init |
66 |
message("random(-5,5) = " & random(-5,5)) |
67 |
message("random(-5,5) = " & random(-5,5)) |
68 |
message("random(-5,5) = " & random(-5,5)) |
69 |
message("random(-5,5) = " & random(-5,5)) |
70 |
end on |
71 |
</code> |
72 |
|
73 |
</body> |
74 |
</html> |