type

Random

src @Js
abstract class Random : Obj

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.

methods

makeSecure

Construct a cryptographically strong random number generator.

makeSeeded

Construct a repeatable, seeded random number generator.

next

Generate 64-bit integer within the given range.

nextBool

Generate random boolean.

nextBuf

Generate a randomized number of bytes.

nextFloat

Generate 64-bit floating point number between 0.0f and 1.0f.

Slot Details

makeSecure

src static Random makeSecure()

Construct a cryptographically strong random number generator.

makeSeeded

src static Random makeSeeded(Int seed := DateTime.nowTicks())

Construct a repeatable, seeded random number generator.

next

src 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

src abstract Bool nextBool()

Generate random boolean.

nextBuf

src abstract Buf nextBuf(Int size)

Generate a randomized number of bytes.

nextFloat

src abstract Float nextFloat()

Generate 64-bit floating point number between 0.0f and 1.0f.