rand.nextInt(n)和rand.nextFloat(n)

268 阅读1分钟

        i = rand.nextInt(n)表示0 <= i  <n,即小于n的随机整数;同理,rand.nextFloat(n) 表示 0 <= i  <n的浮点数。