MyChat Scripts Engine: Random
Getting a random number within a specified range.
Syntax
function Random(x: integer): integer;
Parameters and return values
Parameter |
Type |
Value |
x |
integer |
range of random numbers. |
Function result
Returns a random number within the range from 0 trough x.
Example
var
i, x: integer;
begin
for i := 1 to 10 do begin
x := random(i * 10);
mLogScript(' ' + inttostr(i) + ' - ' + inttostr(x), '');
end;
end.
Script work result
[13:21:45] (Log "Random"): 1 - 4
[13:21:45] (Log "Random"): 2 - 5
[13:21:45] (Log "Random"): 3 - 24
[13:21:45] (Log "Random"): 4 - 5
[13:21:45] (Log "Random"): 5 - 18
[13:21:45] (Log "Random"): 6 - 39
[13:21:45] (Log "Random"): 7 - 65
[13:21:45] (Log "Random"): 8 - 75
[13:21:45] (Log "Random"): 9 - 21
[13:21:45] (Log "Random"): 10 - 53
See also
Created with the Personal Edition of HelpNDoc: Easily create EPub books