Code example for Random

Methods: nextGaussian

0
    if (screenSaver) {
 
      vF += moveVStep;
      if (vF > 1) {
        vF = 1;
        moveVStep = -1.0d * (r.nextGaussian() * 0.01d);
      } 
      if (vF < 0) {
        vF = 0;
        moveVStep = (r.nextGaussian() * 0.01d);
      } 
 
      hF += moveHStep;
      if (hF > 1) {
        hF = 1;
        moveHStep = -1.0d * (r.nextGaussian() * 0.01d);
      } 
      if (hF < 0) {
        hF = 0;
        moveHStep = (r.nextGaussian() * 0.01d);
      } 
      invalidate();
    } 
  }