object Random extends ProductReader[Random]
- Alphabetic
- By Inheritance
- Random
- ProductReader
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final case class Coin[A, B](prob: Ex[A], gen: Random)(implicit num: NumDouble[A] { type Boolean = B }, default: HasDefault[B]) extends Ex[B] with Act with ProductWithAdjuncts with Product with Serializable
A random boolean with a given probability.
A random boolean with a given probability. If
prob
is zero, the output will always befalse
, ifprob
is one, the output will always betrue
, ifprob
is0.5
, the likelihood offalse
andtrue
is equal.This is both an expression and an action. The action draws a new random number, the expression reports the last drawn value.
Example:
val gen = Random() val coin = gen.coin(0.4) Act( coin, // draw new number PrintLn("Random coin (slightly favouring false): " ++ coin.toStr) // print current value )
- final case class Range[A](lo: Ex[A], hi: Ex[A], gen: Random)(implicit num: Num[A]) extends Ex[A] with Act with ProductWithAdjuncts with Product with Serializable
A random number between a given
lo
and a givenhi
boundary.A random number between a given
lo
and a givenhi
boundary. The boundaries are inclusive for integer numbers. For floating point numbers, thehi
bound is exclusive.This is both an expression and an action. The action draws a new random number, the expression reports the last drawn value.
Example:
val gen = Random() val r1to10 = gen.range(1, 10) Act( r1to10, // draw new number PrintLn("Random number (1 to 10): " ++ r1to10.toStr) // print current value )
- final case class Until[A](hi: Ex[A], gen: Random)(implicit num: Num[A]) extends Ex[A] with Act with ProductWithAdjuncts with Product with Serializable
A random number between zero (inclusive) and a given
hi
boundary (exclusive).A random number between zero (inclusive) and a given
hi
boundary (exclusive).hi
may be negative, but it must not be zero.This is both an expression and an action. The action draws a new random number, the expression reports the last drawn value.
Example:
val gen = Random() val r100 = gen.until(100) Act( r100, // draw new number PrintLn("Random number: " ++ r100.toStr) // print current value )
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply(seed: Ex[Long] = TimeStamp()): Random
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def read(in: RefMapIn, key: String, arity: Int, adj: Int): Random
- Definition Classes
- Random → ProductReader
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- object Coin extends ProductReader[Coin[_, _]] with Serializable
- object Range extends ProductReader[Range[_]] with Serializable
- object Until extends ProductReader[Until[_]] with Serializable
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated