RAND.nextDouble replaced with Math.random() to address issue #38