aboutsummaryrefslogtreecommitdiffstats
path: root/misc/random_bugs/create_random_bugs.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-12 17:23:04 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-12 17:23:04 +0200
commit27c5ea5b5b57887f51d5700398ee283dc191fff9 (patch)
tree6212b40e20482559c77510e166330c316a580d5f /misc/random_bugs/create_random_bugs.go
parent60fcfcdcb0e89741528cfc99a94a48f204d48e6b (diff)
downloadgit-bug-27c5ea5b5b57887f51d5700398ee283dc191fff9.tar.gz
random bugs: fix a crash when minOps == maxOps
Diffstat (limited to 'misc/random_bugs/create_random_bugs.go')
-rw-r--r--misc/random_bugs/create_random_bugs.go7
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))