Get Normal Distributed Random - Node.js Number

Node.js examples for Number:Random Number

Description

Get Normal Distributed Random

Demo Code



function getNormalDistributedRandom ( min, max )
{
  var res = ( getRandom( min, max ) + getRandom( min, max ) + getRandom( min, max ) ) / 3;
  return res;//from  www. j  av a  2s .  c  om
}


function getRandom ( min, max )
{
  var res = Math.random();
    // uniform random distributed in [0, 1)
  
  res = min + (max - min)*res;
  
  return res;
}

Related Tutorials