Add seed argument to random functions

Sometimes this is handy for generating repeatable sequences of pseudo-random
numbers (like in tests or for demonstration purposes.)