Rand

vecxt_re.Rand
trait Rand[T]

A trait for monadic distributions. Provides support for use in for-comprehensions

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait ContinuousDistr[T]
class Mixed
class Pareto
trait DiscreteDistr[T]
class Empirical
class Poisson
Show all
Self type
Rand[T]

Members list

Value members

Abstract methods

def draw: T

Gets one sample from the distribution. Equivalent to sample

Gets one sample from the distribution. Equivalent to sample

Attributes

Concrete methods

def drawOpt: Option[T]

Overridden by filter/map/flatmap for monadic invocations. Basically, rejection samplers will return None here

Overridden by filter/map/flatmap for monadic invocations. Basically, rejection samplers will return None here

Attributes

def flatMap[E](f: T => Rand[E]): Rand[E]
inline def get: T
def map[E](f: T => E): Rand[E]

Converts a random sampler of one type to a random sampler of another type. Examples: uniform.map(_2) gives a Rand[Double] in the range [0,2] Equivalently, for(x <- uniform) yield 2x

Converts a random sampler of one type to a random sampler of another type. Examples: uniform.map(_2) gives a Rand[Double] in the range [0,2] Equivalently, for(x <- uniform) yield 2x

Value parameters

f

the transform to apply to the sampled value.

Attributes

inline def sample: T

Gets one sample from the distribution. Equivalent to get

Gets one sample from the distribution. Equivalent to get

Attributes

inline def sample(n: Int): IndexedSeq[T]

Gets n samples from the distribution.

Gets n samples from the distribution.

Attributes

def sampleTo[C](n: Int)(using factory: Factory[T, C]): C

Gets n samples from the distribution into a specified collection type.

Gets n samples from the distribution into a specified collection type.

Attributes

inline def samples: Iterator[T]

An infinitely long iterator that samples repeatedly from the Rand

An infinitely long iterator that samples repeatedly from the Rand

Attributes

Returns

an iterator that repeatedly samples

def withFilter(p: T => Boolean): Rand[T]