Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
struct SeededRandomNumberGenerator: RandomNumberGenerator {
init(seed: Int) {
func next() -> UInt64 {
return UInt64(drand48() * Double(UInt64.max))
var seededGenerator = SeededRandomNumberGenerator(seed: 5)
let random = Int.random(in: -5...5, using: &seededGenerator)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment