Packages

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. 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
)
Linear Supertypes
Serializable, ProductWithAdjuncts, Act, Ex[B], Flow, Lazy, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Coin
  2. Serializable
  3. ProductWithAdjuncts
  4. Act
  5. Ex
  6. Flow
  7. Lazy
  8. Product
  9. Equals
  10. AnyRef
  11. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Coin(prob: Ex[A], gen: Random)(implicit num: NumDouble[A] { type Boolean = B }, default: HasDefault[B])

Type Members

  1. type Repr[T <: Txn[T]] = IExpr[T, B] with IAction[T]
    Definition Classes
    CoinActExFlowLazy

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 adjuncts: List[Adjunct]
    Definition Classes
    CoinProductWithAdjuncts
  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. final def expand[T <: Txn[T]](implicit ctx: Context[T], tx: T): Repr[T]
    Definition Classes
    Lazy
  9. val gen: Random
  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. def mkRepr[T <: Txn[T]](implicit ctx: Context[T], tx: T): Repr[T]
    Attributes
    protected
    Definition Classes
    CoinLazy
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. val prob: Ex[A]
  17. def productElementNames: Iterator[String]
    Definition Classes
    Product
  18. def productPrefix: String
    Definition Classes
    Coin → Product
  19. final val ref: AnyRef
    Attributes
    protected
    Definition Classes
    Lazy
    Annotations
    @transient()
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def update: Act

    Convenient method that returns the Coin itself.

    Convenient method that returns the Coin itself. This can be used for additional clarity when writing Bang() ---> coin.update instead of Bang() ---> coin.

  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

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

Inherited from Serializable

Inherited from ProductWithAdjuncts

Inherited from Act

Inherited from Ex[B]

Inherited from Flow

Inherited from Lazy

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped