Packages

object Random extends ProductReader[Random]

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Random
  2. ProductReader
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. 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 be false, if prob is one, the output will always be true, if prob is 0.5, the likelihood of false and true 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
    )
  2. 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 given hi boundary.

    A random number between a given lo and a given hi boundary. The boundaries are inclusive for integer numbers. For floating point numbers, the hi 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
    )
  3. 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

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(seed: Ex[Long] = TimeStamp()): Random
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. def read(in: RefMapIn, key: String, arity: Int, adj: Int): Random
    Definition Classes
    RandomProductReader
  16. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  17. def toString(): String
    Definition Classes
    AnyRef → Any
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. object Coin extends ProductReader[Coin[_, _]] with Serializable
  22. object Range extends ProductReader[Range[_]] with Serializable
  23. object Until extends ProductReader[Until[_]] with Serializable

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from ProductReader[Random]

Inherited from AnyRef

Inherited from Any

Ungrouped