blob: 99743e7777ce26b24f40c40d74e356929e323291 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package utils
import (
"math/rand"
)
type Range struct {
Begin int
End int
}
func RandIntFromRange(r Range) int {
if r.End-r.Begin <= 0 {
return r.Begin
}
return rand.Intn((r.End-r.Begin)+1) + r.Begin
}
|