tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Uncommons Maths > Continuous Uniform Generator

Continuous Uniform Generator 

Uncommons Maths is a java library with nice math utilities and random number generators. This requires the library uncommons-maths-1.2.2.jar to be in classpath. The following example shows using ContinuousUniformGenerator class.

File Name  :  
com/bethecoder/tutorials/uncommons/ContinuousUniformGeneratorTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.uncommons;

import java.util.Random;
import org.uncommons.maths.random.ContinuousUniformGenerator;

public class ContinuousUniformGeneratorTest {

  /**
   @param args
   */
  public static void main(String[] args) {

    ContinuousUniformGenerator rand = 
      new ContinuousUniformGenerator(20.1d40.2dnew Random());

    for (int i = ; i < 10 ; i ++) {
      System.out.println(rand.nextValue());
    }
    
  }

}
   

It gives the following output,
31.03947101851942
39.33441276686378
33.44549261658027
26.914675517092455
40.06865495560609
31.059009192570944
23.04258787216547
39.6308736768093
23.00314913162588
38.26408576173208



 
  


  
bl  br