Core Function RandomVar

From Sputnik Wiki
Jump to: navigation, search
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();
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox