Pseudo RNGs

This recent thread covers some non-cryptographic rng stuff, including using the (juicy) init.io.random for the “easiest” way forward the likes of die-rolling. You might find some help there.

Yes, it looks like next() returns a u64; even though you %6 that value, you could add a million to it, instead of just 1. Obviously you don’t, and you might think the compiler should see that the result can fit into 8 bits, but, alas, you’ll have to @truncate that result. Since you’re sure that won’t modify your value, you can do it safely. This expresses your intent clearly, rather than leaving it as “implied”, anyway.