abstract class util::Random
sys::Obj util::Random
@Js
Random provides different implementation of random number generators with more flexibility than the methods available in sys. Also see Int.random
, Float.random
, Range.random
, and List.random
.
- makeSecure
-
static Random makeSecure()
Construct a cryptographically strong random number generator.
- makeSeeded
-
static Random makeSeeded(Int seed := DateTime.nowTicks())
Construct a repeatable, seeded random number generator.
- next
-
abstract Int next(Range? r := null)
Generate 64-bit integer within the given range. If range is null, assume full range of 64-bit integers
- nextBool
-
abstract Bool nextBool()
Generate random boolean.
- nextBuf
-
abstract Buf nextBuf(Int size)
Generate a randomized number of bytes.
- nextFloat
-
abstract Float nextFloat()
Generate 64-bit floating point number between 0.0f and 1.0f.