Created
October 25, 2018 15:41
-
-
Save luther9/01d38d09148e0ae88b19c3cb1cfdaac0 to your computer and use it in GitHub Desktop.
Not seeding the RNG is equivalent to a seed of 1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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