RandBasis

class RandBasis(val generator: RandomGenerator) extends Serializable

Provides standard combinators and such to use to compose new Rands.

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

Value members

Concrete methods

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

The trivial random generator: always returns the argument

The trivial random generator: always returns the argument

def choose[T](c: Iterable[T]): Rand[T]

Chooses an element from a collection.

Chooses an element from a collection.

def choose[T](c: Seq[T]): Rand[T]
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

Samples a gaussian with m mean and s std

Samples a gaussian with m mean and s std

Implements the Knuth shuffle of numbers from 0 to n.

Implements the Knuth shuffle of numbers from 0 to n.

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]]

def promote[T1, T2](t: (Rand[T1], Rand[T2])): Rand[(T1, T2)]
def promote[T1, T2, T3](t: (Rand[T1], Rand[T2], Rand[T3])): Rand[(T1, T2, T3)]
def promote[T1, T2, T3, T4](t: (Rand[T1], Rand[T2], Rand[T3], Rand[T4])): Rand[(T1, T2, T3, T4)]
def randInt(n: Int): Rand[Int]

Uniformly samples an integer in [0,n)

Uniformly samples an integer in [0,n)

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

Uniformly samples an integer in [n,m)

Uniformly samples an integer in [n,m)

Uniformly samples a long integer in [0,n)

Uniformly samples a long integer in [0,n)

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

Uniformly samples a long integer in [n,m)

Uniformly samples a long integer in [n,m)

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

Concrete fields

Samples a gaussian with 0 mean and 1 std

Samples a gaussian with 0 mean and 1 std

Uniformly samples an integer in [0,MAX_INT]

Uniformly samples an integer in [0,MAX_INT]

Uniformly samples a long integer in [0,MAX_LONG]

Uniformly samples a long integer in [0,MAX_LONG]

Uniformly samples in [0,1)

Uniformly samples in [0,1)