class Rooibos::Message::Random

Response from a random command.

Games roll dice. Encryption needs keys. Shuffling needs seeds. All of these call Kernel#rand or Random. But randomness in Update is a side effect: the same model and message would produce different results on each call. Testing would become fragile.

This response carries the random value from the runtime. Update pattern-matches on the envelope to distinguish multiple rolls.

Use it to handle Command.random completions.

Example

case msg
in { type: :random, envelope: :roll_die, value: }
  model.with(roll: value)
in { type: :random, envelope: :shuffle_seed, value: }
  model.with(sort_seed: value)
end