Adaptation to JavaScript of randomLHS.R (by Doug Mooney, Rob Carnell)