API Reference › Random › Random.int
method

Random.int

Random.int(max) -> int

Returns a deterministic integer from 0 up to but not including max. Use it to pick a random index into a list of length max. Returns 0 when max is not positive.

Example

program Demo {
  handler Seed phase Start { Random.seed(value: 7) }
  handler Step phase Update {
    let idx = Random.int(list_count)
  }
}
}
}
← All symbols