final case class Range[A](lo: Ex[A], hi: Ex[A], gen: Random)(num: Num[A]) extends Ex[A] with Act with ProductWithAdjuncts
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.
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
)
- Companion
- object