public class StdRandomUtil extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static long |
getSeed()
获取种子值
|
static double |
random()
随机返回0到1之间的实数 [0,1)
|
static void |
setSeed(long s)
设置种子值
|
static double |
uniform()
随机返回0到1之间的实数 [0,1)
|
static double |
uniform(double a,
double b)
随机返回a到b之间的实数
|
static int |
uniform(int N)
随机返回0到N-1之间的整数 [0,N)
|
static int |
uniform(int a,
int b)
随机返回a到b-1之间的整数 [a,b)
|
public static void setSeed(long s)
s - 随机数生成器的种子值public static long getSeed()
public static double uniform()
public static int uniform(int N)
N - 上限public static double random()
public static int uniform(int a,
int b)
a - 下限b - 上限public static double uniform(double a,
double b)
a - 下限b - 上限Copyright © 2019. All rights reserved.