Add an optional seed parameter

We have to use math/rand instead of crypto/rand if seed
is provided.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>