Java Tutorial/Apache Common/RandomUtils

Материал из Java эксперт
Перейти к: навигация, поиск

Random Utils

   <source lang="java">

import org.apache.rumons.lang.math.RandomUtils; public class MainClass {

   public static void main(String[] args) {
     //Random Value Generation
     System.out.println("Random double >>> " + RandomUtils.nextDouble());
     System.out.println("Random float >>> " + RandomUtils.nextFloat());
     System.out.println("Random int >>> " + RandomUtils.nextInt());
   }

}</source>



Random double >>> 0.4784342304088153
Random float >>> 0.9024083
Random int >>> 268959030