RNG

io.github.srs.utils.random.RNG
trait RNG

A trait representing a Random Number Generator (RNG).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class SimpleRNG

Members list

Value members

Abstract methods

def nextBoolean: (Boolean, RNG)

Generates a random boolean value along with the next RNG state.

Generates a random boolean value along with the next RNG state.

Attributes

Returns

a tuple containing a random boolean and the next RNG state.

def nextDouble: (Double, RNG)

Generates a random double value within the range [0.0, 1.0) along with the next RNG state.

Generates a random double value within the range [0.0, 1.0) along with the next RNG state.

Attributes

Returns

a tuple containing a random double and the next RNG state.

def nextDoubleBetween(min: Double, max: Double, isMaxExcluded: Boolean): (Double, RNG)

Generates a random double value within a specified range.

Generates a random double value within a specified range.

Value parameters

isMaxExcluded

whether the maximum value is excluded.

max

the maximum value (exclusive or inclusive based on isMaxExcluded).

min

the minimum value (inclusive).

Attributes

Returns

a tuple containing a random double and the next RNG state.

def nextInt: (Int, RNG)

Generates a random integer value along with the next RNG state.

Generates a random integer value along with the next RNG state.

Attributes

Returns

a tuple containing a random integer and the next RNG state.

def nextIntBetween(min: Int, max: Int, isMaxExcluded: Boolean): (Int, RNG)

Generates a random integer value within a specified range (inclusive of min, exclusive of max).

Generates a random integer value within a specified range (inclusive of min, exclusive of max).

Value parameters

max

the maximum value (exclusive).

min

the minimum value (inclusive).

Attributes

Returns

a tuple containing a random integer and the next RNG state.

def nextLong: (Long, RNG)

Generates a random long value along with the next RNG state.

Generates a random long value along with the next RNG state.

Attributes

Returns

a tuple containing a random long and the next RNG state.

def nextString(length: Int): (String, RNG)

Generates a random string of a specified length.

Generates a random string of a specified length.

Value parameters

length

the length of the random string to generate.

Attributes

Returns

a tuple containing a random string and the next RNG state.

def shuffle[A](seq: Seq[A]): (Seq[A], RNG)

Shuffles a sequence of elements randomly.

Shuffles a sequence of elements randomly.

Value parameters

seq

the sequence to shuffle.

Attributes

Returns

a tuple containing the shuffled sequence and the next RNG state.