random bugs: fix a crash when minOps == maxOps

This commit is contained in:
Michael Muré 2018-09-12 17:23:04 +02:00
parent 60fcfcdcb0
commit 27c5ea5b5b
No known key found for this signature in database
GPG Key ID: A4457C029293126F

View File

@ -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))