diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-12 17:23:04 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-12 17:23:04 +0200 |
commit | 27c5ea5b5b57887f51d5700398ee283dc191fff9 (patch) | |
tree | 6212b40e20482559c77510e166330c316a580d5f /misc | |
parent | 60fcfcdcb0e89741528cfc99a94a48f204d48e6b (diff) | |
download | git-bug-27c5ea5b5b57887f51d5700398ee283dc191fff9.tar.gz |
random bugs: fix a crash when minOps == maxOps
Diffstat (limited to 'misc')
-rw-r--r-- | misc/random_bugs/create_random_bugs.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/misc/random_bugs/create_random_bugs.go b/misc/random_bugs/create_random_bugs.go index f2d7e7c3..14c2b26f 100644 --- a/misc/random_bugs/create_random_bugs.go +++ b/misc/random_bugs/create_random_bugs.go @@ -72,7 +72,12 @@ func GenerateRandomBugsWithSeed(opts Options, seed int64) []*bug.Bug { panic(err) } - nOps := opts.MinOp + rand.Intn(opts.MaxOp-opts.MinOp) + nOps := opts.MinOp + + if opts.MaxOp > opts.MinOp { + nOps += rand.Intn(opts.MaxOp - opts.MinOp) + } + for j := 0; j < nOps; j++ { index := rand.Intn(len(opsGenerators)) opsGenerators[index](b, randomPerson(opts.PersonNumber)) |