rand

molecule.boilerplate.api.KeywordsStable.rand
trait rand extends AggrKw

Random attribute value(s).

Apply random keyword to attribute to return a single random attribute of entities matching the molecule.

for {
 _ <- Person.age.insert(25, 34, 37, 42, 70)
 _ <- Person.age(random).get.map(_.head ==> 34) // or other..
} yield ()

Apply random(n) to return Vector of n random values. Observe though that duplicate random values can re-occur.

Person.age(random(3)).get.map(_.head ==> Vector(42, 25, 42)) // or other..

To get distinct values only, use the sample(n) keyword instead.

Attributes

Source
Keywords.scala
Graph
Supertypes
trait AggrKw
trait Kw
class Object
trait Matchable
class Any
Known subtypes
object rand.type

Members list

Grouped members

aggregates

def apply(n: Int): rands

Random values of attribute.

Apply a number n to random to return Stream of n random attribute values of from entities matching the molecule.
Observe that duplicate random values can re-occur.

Random values of attribute.

Apply a number n to random to return Stream of n random attribute values of from entities matching the molecule.
Observe that duplicate random values can re-occur.

for {
 _ <- Person.age.insert(25, 34, 37, 42, 70)
 _ <- Person.age(random(3)).get.map(_.head ==> Stream(42, 25, 42)) // or other..
} yield ()

To get distinct values only, use the sample(n) keyword instead.

Attributes

Returns

List[attribute-type]

Source
Keywords.scala