rand()

Read(3035) Label: random number,

Description:

Get a random number.

Syntax:

rand(n)

Note:

The function returns a random number between 0 and 1.

Parameter:

n

An integer, without it the function returns a random float number between 0 and 1.0

Option:

@s

Set the seed value for generating a random number

Return value:

Numeric type

Example:

rand()

Get a random number in the range of [0, 1.0].

rand()*100

Get a random float number in the range of [0, 100].

rand(100)

Get a random integer in the range of [0, 100].

The seed value for generating a random number

 

A

 

1

=rand@s(5)

 

2

=10.(rand())

 

3

= rand@s(5)

 

4

=10.(rand())

The 10 random numbers generated in A4 and A2 are identical.