Skip to content

Instantly share code, notes, and snippets.

@luther9
Created October 25, 2018 15:41
Show Gist options
  • Save luther9/01d38d09148e0ae88b19c3cb1cfdaac0 to your computer and use it in GitHub Desktop.
Save luther9/01d38d09148e0ae88b19c3cb1cfdaac0 to your computer and use it in GitHub Desktop.
Not seeding the RNG is equivalent to a seed of 1.
package main
import (
"fmt"
"math/rand"
)
func show5(f func() int) {
for i := 0; i < 5; i++ {
fmt.Println(f())
}
fmt.Println()
}
func main() {
show5(rand.Int)
show5(rand.New(rand.NewSource(1)).Int)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment