github.com/geph-official/geph2@v0.22.6-0.20210211030601-f527cb59b0df/libs/cshirt2/utilities.go (about)

     1  package cshirt2
     2  
     3  import "encoding/binary"
     4  
     5  // NewRNG creates a new RNG based on a seed.
     6  func NewRNG(seed []byte) func() uint64 {
     7  	seed = mac128(seed, seed)
     8  	return func() uint64 {
     9  		seed = mac128(seed, seed)
    10  		return binary.LittleEndian.Uint64(seed[:8])
    11  	}
    12  }