Functions

createDecimal
I

Generates a random decimal number between 0.0 and 1.0.

createIntInRange
I

Generates a random number between the given start(inclusive) and end(exclusive) values.

createDecimal

function createDecimal() returns float
Isolated Function

Generates a random decimal number between 0.0 and 1.0.

1float randomValue = random:createDecimal();

Return Type

(float)

Selected random value

createIntInRange

function createIntInRange(int startRange, int endRange) returns int | Error
Isolated Function

Generates a random number between the given start(inclusive) and end(exclusive) values.

1int randomInteger = check random:createIntInRange(1, 100);

Parameters

  • startRange int
  • Range start value

  • endRange int
  • Range end value

Return Type

(int | Error)

Selected random value or else a random:Error if the start range is greater than the end range