Random: random

Syntax

random ( seed , index )

Input parameters

seed

the seed

index

the index

Examples of valid syntaxes

random(15,12)
ds [calc r := random(col_1, 12)]
random(ds, 12);

Semantics for scalar operations

The operator generates a sequence number >= 0 and <1, based on seed parameter and returns

the number value corresponding to index.

Input parameters type

seed

dataset { measure<number> _+ }
| component<number>
| number

index

integer

Result type

result

dataset { measure<number> _+ }
| component<number[0-1] >
| number[0-1]

Additional Constraints

None.

Behaviour

The operator returns a random decimal number >= 0 and <1.

Examples

Given the operand dataset DS_1:

Input DS_1 (see structure)

Id_1

Id_2

Me_1

10

A

16.0

10

B

4.0

11

A

7.2

Example 1

DS_r := random(DS_1,5);

results in (see structure):

DS_r

Id_1

Id_2

Me_1

10

A

0.3582791

10

B

0.428819

11

A

0.715488

Example 2

DS_r  := DS_1 [ calc Me_2 := random( Me_1, 8 ) ];

results in (see structure):

DS_r

Id_1

Id_2

Me_1

Me_2

10

A

16.0

0.7545341

10

B

4.0

0.3457166

11

A

7.2

0.5183224