From 9fe9959c76c96ec3284f43c692cbb099230dcb73 Mon Sep 17 00:00:00 2001 From: Yawning Angel Date: Wed, 28 May 2014 04:22:36 +0000 Subject: Change the weighted distribution algorithm be uniform. The old way was biasted towards the earlier values. Thanks to asn for pointing this out and suggesting an alternative. As an additional tweak, do not reuse the drbg seed when calculating the IAT distribution, but instead run the seed through SHA256 first, for extra tinfoil goodness. --- csrand/csrand.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'csrand') diff --git a/csrand/csrand.go b/csrand/csrand.go index 721fb1e..a3299aa 100644 --- a/csrand/csrand.go +++ b/csrand/csrand.go @@ -68,7 +68,12 @@ func (r csRandSource) Seed(seed int64) { // No-op. } -// Float64 returns, as a float 64, a pesudo random number in [0.0,1.0). +// Int63n returns, as a int64, a pseudo random number in [0, n). +func Int63n(n int64) int64 { + return CsRand.Int63n(n) +} + +// Float64 returns, as a float64, a pesudo random number in [0.0,1.0). func Float64() float64 { return CsRand.Float64() } -- cgit v1.2.3