Core Function RandomVar
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> RandomVar( <seed>, <flag> ) </pre> === Description === Generator a random number. === Parameters === == flag == Optional; Type of random number to generate. <pre> 0 =...") |
(→Example) |
||
Line 49: | Line 49: | ||
<syntaxhighlight lang="sputnik"> | <syntaxhighlight lang="sputnik"> | ||
+ | $random = RandomVar(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Core Function]] | [[Category:Core Function]] |
Revision as of 23:25, 26 July 2014
RandomVar( <seed>, <flag> )
Contents |
Description
Generator a random number.
Parameters
flag
Optional; Type of random number to generate.
0 = Generate a random unsigned Byte 1 = Generate a random unsigned Int16 2 = Generate a random unsigned Int32 3 = Generate a random unsigned Int64 4 = Generate a random signed Byte 5 = Generate a random signed Int16 6 = Generate a random signed Int32 7 = Generate a random signed Int64 8 = Generate a random Float 9 = Generate a random Double
Default: 7
seed
Optional; A seed to use when generating the random number.
This is not needed since Sputnik generates it's own seeds but you may choose to provide yours.
Return Value
Success: Returns a random number.
Failure: Does not return a random number (0).
Remarks
This uses the the Random() function to do the generating.
If you are looking for a stronger way to create Seeds then look at RandomSeed() instead.
Example
$random = RandomVar();