Rnd.java 422 Bytes
Newer Older
Juon Kawakami's avatar
init  
Juon Kawakami committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package firesimulator.util;

import java.util.Random;

/**
 * @author tn
 *
 */
public class Rnd {

  private static Random rnd;


  public static void setSeed( long seed ) {
    if ( seed <= 0 )
      rnd = new Random( System.currentTimeMillis() );
    else
      rnd = new Random( seed );
  }


  public static double get01() {
    if ( rnd == null ) {
      rnd = new Random();
    }
    return rnd.nextDouble();
  }

}