Constant Functions

This package deals with the Rand and the SRand functions.

This page discusses:

Rand

A method used to generate a random number. Use Srand to initialize the random algorithm seed.

Signature

Rand() : Real

ReturnType

The returned value is a random real number between 0 and 1.

Real

Example

// Generating a random number between 0 and 1
let myRandomInteger(Integer)
let d(Date)
let i(Integer)
Let sDate(String)
let randomNumber(Integer)

// Initializing the random seed with the current date
sDate = DateFormat("%H%M%S", BuildDate())
i = sDate->ToReal(): Integer

SRand(i)

randomNumber = Rand()*11

SRand

Function that initializes the seed for random numbers generation. Use Rand() to generate the number

Signature

SRand(seed : Integer)

Arguments

Name Input / Output Required? Type Comment
seed In Yes Integer The seed for the random algorithm.

Example

/ Generating a random number between 0 and 10
let myRandomInteger(Integer)
let d(Date)
let i(Integer)
Let sDate(String)
let randomNumber(Integer)

// Initializing the random seed with the current date
sDate = DateFormat("%H%M%S", BuildDate())
i = sDate->ToReal(): Integer

SRand(i)

randomNumber = Rand()*11