Right! Ok. Yes, that makes a lot more sense. I'm parking my random vector/matrix stuff because it's clear (to me at least) that Vector&Matrix need some revamping.
But still, how should a random based on MurmurHash work? Lance On Fri, May 20, 2011 at 7:29 PM, Ted Dunning <ted.dunn...@gmail.com> wrote: > No. I was referring to the specific use of random number generators to > generate an ephemeral random matrix. I prefer to hash the element location > in order to generate the element value than to use a random number generator > seeded by the element location. These are formally equivalent but > practically quite different since hash functions are often designed with > fast startup and PRNG's are often designed without much regard to startup or > reseeding cost. MersenneTwister in particular is a very bad generator with > respect to the cost of reseeding. Murmurhash is a very good example of a > lean hash function. > > On Fri, May 20, 2011 at 7:25 PM, Lance Norskog (JIRA) <j...@apache.org>wrote: > >> >> Ted, you mentioned wanting a MurmurHash Random class. Is this what you >> envisioned? (It is not finished code; see below). >> >> {code} >> public class MurmurHashRandom extends Random { >> private long murmurSeed; >> private final ByteBuffer buf; >> >> public MurmurHashRandom() { >> this(0); >> } >> >> public MurmurHashRandom(int seed) { >> SeedGenerator gen = new FastRandomSeedGenerator(); >> byte[] bits = RandomUtils.longSeedtoBytes(gen.generateSeed()); >> buf = ByteBuffer.wrap(bits); >> this.murmurSeed = MurmurHash.hash64A(bits, seed); >> } >> >> @Override >> public long nextLong() { >> long oldSeed = murmurSeed; >> murmurSeed = MurmurHash.hash64A(buf, (int) murmurSeed); >> return oldSeed; >> } >> >> {code} >> >> > -- Lance Norskog goks...@gmail.com