fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 310: Fill array with random bytes
Idiom # 310: Fill array with random bytes
See
programming-idioms.org
:
Code
rand_bytes => (random.next_u32 255).as_u8 : rand_bytes a := rand_bytes.take n .as_array
What are effects?
Runnable Example
ex310 is # Create a random provider with the given seed # ensures deterministic sequence of random output for testing simple_random 3523248709069810085 ()-> rand_bytes => (random.next_u32 255).as_u8 : rand_bytes n := 5 for _ in 0..2 do a := rand_bytes.take n .as_array say a
What are effects?
last changed: 2024-07-01
next: NYI: Idiom # 311: Deep copy an object