小编use*_*902的帖子

在制作n的随机整数倍的数组时,程序任意修改数组

    public class Tester {
        public static int randomInt(int low, int high){//this method finds a random integer in between the range of low and high.
            return (int)(Math.random()*(high-low)+low);
        }
        public static int[] randomArray(int[] a){//this method enters those random integers into an array of 100 length.
            for(int i = 0;i<a.length; i++){
                a[i] = randomInt(0, 100);
            }
            return a;
        }
        public static int[] multiple(int[] a, int n){//this method replaces the input array with a new array consisting of (random) multiples of n
            int[] x …
Run Code Online (Sandbox Code Playgroud)

java arrays random

1
推荐指数
1
解决办法
45
查看次数

标签 统计

arrays ×1

java ×1

random ×1