Exemple #1
0
func BenchmarkXorshift(b *testing.B) {

	r := xorshift.NewXorShift64Star(0x0ddc0ffeebadf00d)

	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		total += uint32(r.Next())
	}
}
Exemple #2
0
package pmc

import (
	"errors"
	"fmt"
	"math"
	"strconv"

	"code.google.com/p/gofarmhash"

	"github.com/lazybeaver/xorshift"
	"github.com/lukut/bitmaps"
)

var xor64s = xorshift.NewXorShift64Star(42)

// non-receiver methods

func georand(w uint) uint {
	val := uint(xor64s.Next())
	// Calculate the position of the leftmost 1-bit.
	for r := uint(0); r < w-1; r++ {
		if val&0x8000000000000000 != 0 {
			return r
		}
		val <<= 1
	}
	return w
}

func rand(m uint) uint {