Rand

object Rand extends RandBasis

Provides a number of random generators, with random seed set to some function of system time and identity hashcode of some object

Companion:
class
class RandBasis
trait Serializable
class Object
trait Matchable
class Any
Rand.type

Type members

Classlikes

object FixedSeed

Import the contents of this to use a generator seeded with a consistent seed.

Import the contents of this to use a generator seeded with a consistent seed.

Import the contents of this to make Rands/Distributions that use the "default" generator

Import the contents of this to make Rands/Distributions that use the "default" generator

Value members

Inherited methods

def always[T](t: T): Rand[T]

The trivial random generator: always returns the argument

The trivial random generator: always returns the argument

Inherited from:
RandBasis
def choose[T](c: Seq[T]): Rand[T]
Inherited from:
RandBasis
def choose[T](c: Iterable[T]): Rand[T]

Chooses an element from a collection.

Chooses an element from a collection.

Inherited from:
RandBasis
def fromBody[T](f: => T): Rand[T]

Simply reevaluate the body every time get is called

Simply reevaluate the body every time get is called

Inherited from:
RandBasis

Samples a gaussian with m mean and s std

Samples a gaussian with m mean and s std

Inherited from:
RandBasis

Implements the Knuth shuffle of numbers from 0 to n.

Implements the Knuth shuffle of numbers from 0 to n.

Inherited from:
RandBasis
def promote[T1, T2, T3, T4](t: (Rand[T1], Rand[T2], Rand[T3], Rand[T4])): Rand[(T1, T2, T3, T4)]
Inherited from:
RandBasis
def promote[T1, T2, T3](t: (Rand[T1], Rand[T2], Rand[T3])): Rand[(T1, T2, T3)]
Inherited from:
RandBasis
def promote[T1, T2](t: (Rand[T1], Rand[T2])): Rand[(T1, T2)]
Inherited from:
RandBasis
def promote[U](col: Seq[Rand[U]]): Rand[Seq[U]]

Convert an Seq of Rand[T] into a Rand[Seq[T]]

Convert an Seq of Rand[T] into a Rand[Seq[T]]

Inherited from:
RandBasis
def randInt(n: Int, m: Int): Rand[Int]

Uniformly samples an integer in [n,m)

Uniformly samples an integer in [n,m)

Inherited from:
RandBasis
def randInt(n: Int): Rand[Int]

Uniformly samples an integer in [0,n)

Uniformly samples an integer in [0,n)

Inherited from:
RandBasis
def randLong(n: Long, m: Long): Rand[Long]

Uniformly samples a long integer in [n,m)

Uniformly samples a long integer in [n,m)

Inherited from:
RandBasis

Uniformly samples a long integer in [0,n)

Uniformly samples a long integer in [0,n)

Inherited from:
RandBasis
def subsetsOfSize[T](set: IndexedSeq[T], n: Int): Rand[IndexedSeq[T]]

Knuth shuffle of a subset of size n from a set

Knuth shuffle of a subset of size n from a set

Inherited from:
RandBasis

Inherited fields

Samples a gaussian with 0 mean and 1 std

Samples a gaussian with 0 mean and 1 std

Inherited from:
RandBasis

Uniformly samples an integer in [0,MAX_INT]

Uniformly samples an integer in [0,MAX_INT]

Inherited from:
RandBasis

Uniformly samples a long integer in [0,MAX_LONG]

Uniformly samples a long integer in [0,MAX_LONG]

Inherited from:
RandBasis

Uniformly samples in [0,1)

Uniformly samples in [0,1)

Inherited from:
RandBasis