Java Math random numbers generate between 0.0 and 1.0

Introduction

We can use to obtain a random double value between 0.0 and 1.0, excluding 1.0.

public class Main {
  public static void main(String[] args) {
   //w  w w.  j  a  v a2 s . c o  m
      System.out.println( Math.random()); 

  }
}



PreviousNext

Related