flang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 250: Pick a random value from a map
Idiom # 250: Pick a random value from a map
See
programming-idioms.org
:
Code
x := m.values .drop (random.next_i32 m.size) .head
What are effects?
Runnable Example
ex250 is m := map_of [(1, "red"), (2, "pink"), (3, "lilac"), (4, "purple"), (5, "rose")] x := m.values .drop (random.next_i32 m.size) .head say x
What are effects?
next: Idiom # 251: Parse binary digits