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

Exponential 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 ExponentialGenerator class.

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

import java.util.Random;

import org.uncommons.maths.random.ExponentialGenerator;

public class ExponentialGeneratorTest {

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

    ExponentialGenerator rand = new ExponentialGenerator(0.000786dnew Random());

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

}
   

It gives the following output,
1272.7026873596476
412.75678391244475
149.81657706367767
918.101609472915
22.300243125220817
3212.078407028688
1994.1502525133972
930.1557911515964
801.1398892359788
2594.1764046935727



 
  


  
bl  br