Mahout has an implementation as well.
On Sunday, February 20, 2011, Dawid Weiss <[email protected]> wrote: > Ok, I get it. Ted's suggestion is probably something to follow -- > instead of seeding congruential random with a checksum of your vector > (which I assume you did and caused values < 0.2) you can calculate a > better checksum (and convert it to a double from bits directly?). > MurmurHash is a good option, Andrzej Bialecki had an implementation > for streaming checksums, HPPC has one for permuting primitive types: > > http://labs.carrotsearch.com/download/hppc/0.3.3/api/com/carrotsearch/hppc/hash/package-summary.html > > Dawid > > On Mon, Feb 21, 2011 at 4:08 AM, Ted Dunning <[email protected]> wrote: >> This is why we normally use prng's based on murmur hash for building >> deterministic random vectors. Smutty and Jake can probably get you a >> specific pointer before I get back to a real computer. Alternately >> search for references to MurmurHash. >> >> On Sunday, February 20, 2011, Lance Norskog <[email protected]> wrote: >>> I discovered this when I wanted to make deterministic random vectors >>> and matrices. To get the same result from each entry on every access, >>> I can either cache the values or use an algorithm to recreate unique >>> seed for that entry. I naively just added the coordinate to the base >>> seed, and created very not-random vectors and matrices. Yes, the JDK >>> Random is intended to be lame but fast., but this was just too far >>> over the line. >>> >>> Lance >>> >>> On Sun, Feb 20, 2011 at 2:31 AM, Dawid Weiss >>> <[email protected]> wrote: >>>> A perhaps better question is what are you trying to prove or what was >>>> your original intention? :) This is a very strange program indeed -- >>>> what it does is basically check what the next double value from a >>>> fixed initial seed is... since random uses a relatively simple >>>> congruential algorithm, the result isn't really that surprising (to >>>> me?). >>>> >>>> Dawid >>>> >>>> On Sun, Feb 20, 2011 at 2:51 AM, Lance Norskog <[email protected]> wrote: >>>>> What does this program print? >>>>> >>>>> >>>>> package hack; >>>>> >>>>> import java.util.Random; >>>>> >>>>> public class JDKRandomThreatOrMenace { >>>>> >>>>> public static void main(String[] args) { >>>>> Random rnd = new Random(0); >>>>> >>>>> double last = rnd.nextDouble(); >>>>> long i = 1; >>>>> for(; i < Long.MAX_VALUE; i++) { >>>>> rnd.setSeed(i); >>>>> double next = rnd.nextDouble(); >>>>> if (Math.abs(next - last) > 0.2) >>>>> break; >>>>> } >>>>> System.out.println(i); >>>>> } >>>>> >>>>> } >>>>> >>>>> Your prize if you get it right? A patch would be welcome... >>>>> >>>>> >>>> >>> >>> >>> >>> -- >>> Lance Norskog >>> [email protected] >>> >> >> >
