Ballerina library
random
Module random
Definitions

ballerina/random Ballerina library
1.6.0
Functions
createDecimal
Isolated Function
function createDecimal() returns float
Generates a random decimal number between 0.0 and 1.0.
float randomValue = random:createDecimal();
Return Type
- float - Selected random value
createIntInRange
Isolated Function
Generates a random number between the given start(inclusive) and end(exclusive) values. Please note that the generated number is not cryptographically secured.
int randomInteger = check random:createIntInRange(1, 100);
Errors
random: ArithmeticError
Distinct
Represents the arithmetic error.
random: Error
Distinct
Represents Random module related errors.
Import
import ballerina/random;
Metadata
Released date: 11 days ago
Version: 1.6.0
License: Apache-2.0
Compatibility
Platform: java21
Ballerina version: 2201.11.0
GraalVM compatible: Yes
Pull count
Total: 31494
Current verison: 140
Weekly downloads
Keywords
pseudo-random
Contributors
Dependencies