bump(github.com/benbjohnson/go-raft): d46748244f1f1830a002b8f645342426c5d73e81

This commit is contained in:
Brandon Philips
2013-08-06 11:18:15 -07:00
parent c03d4666b8
commit bb7ed9314b
53 changed files with 5337 additions and 0 deletions

View File

@ -0,0 +1,17 @@
package raft
import (
"math/rand"
"time"
)
// Waits for a random time between two durations and sends the current time on
// the returned channel.
func afterBetween(min time.Duration, max time.Duration) <-chan time.Time {
rand := rand.New(rand.NewSource(time.Now().UnixNano()))
d, delta := min, (max - min)
if delta > 0 {
d += time.Duration(rand.Int63n(int64(delta)))
}
return time.After(d)
}