summaryrefslogtreecommitdiff
path: root/csrand
diff options
context:
space:
mode:
authorYawning Angel <yawning@schwanenlied.me>2014-06-19 06:29:12 +0000
committerYawning Angel <yawning@schwanenlied.me>2014-06-19 06:29:12 +0000
commit5abad1571c7d0869e29d55ca01df83fef8cd4606 (patch)
treef6bb184672a435f98b5c7c9713aaacb0d37c5ce0 /csrand
parent6245391c93adf7b9617888d9d9ca8b12518cc52a (diff)
Use Vose's Alias Method to sample the weighted distribution.
The weight generation code also was cleaned up (and now can support generating distributions that look like what ScrambleSuit does as a compile time change). Per: http://www.keithschwarz.com/darts-dice-coins/
Diffstat (limited to 'csrand')
-rw-r--r--csrand/csrand.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/csrand/csrand.go b/csrand/csrand.go
index a3299aa..b059ed0 100644
--- a/csrand/csrand.go
+++ b/csrand/csrand.go
@@ -68,9 +68,9 @@ func (r csRandSource) Seed(seed int64) {
// No-op.
}
-// Int63n returns, as a int64, a pseudo random number in [0, n).
-func Int63n(n int64) int64 {
- return CsRand.Int63n(n)
+// Intn returns, as a int, a pseudo random number in [0, n).
+func Intn(n int) int {
+ return CsRand.Intn(n)
}
// Float64 returns, as a float64, a pesudo random number in [0.0,1.0).