Skip to content

Commit

Permalink
Add Seed() call to set a deterministic seed for the RNG
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwald committed Nov 30, 2015
1 parent 84bff6d commit f481f84
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ var (
ErrNoSamplesFn = func(lang string) error { return fmt.Errorf("No samples found for language: %s", lang) }
)

// Seed sets the seed of the random number generator. If not called, the RNG will be seeded with the current time.
func Seed(seed int64) {
r = rand.New(rand.NewSource(seed))
}

// GetLangs returns a slice of available languages
func GetLangs() []string {
var langs []string
Expand Down

0 comments on commit f481f84

Please sign in to comment.