_rand Function

Purpose

Generates a 32-bit integer pseudo random number.

Syntax

x = _rand[()]

x : ivar

Description

_rand returns a random integer value between 0 and 32767.

_rand and its seed function _srand are C-compatible functions and are offered as an alternative to Rnd, Rand, Random and their seed function Randomize.

Example

Global x%

x = _rand()

MsgBox x

Remarks

To create a random value GFA-BASIC 32 uses the 'C'-randomizer, which doesn't need the Randomize command to initialize the generator, but instead uses _srand.

_rand() is faster than Rand(), but doesn't have the longer period as Rand().

See Also

_rand, _srand, Rand, Randomize, Random, Rnd

{Created by Sjouke Hamstra; Last updated: 20/09/2014 by James Gaite}