我需要创建一个整数数组(双精度和浮点数也很好,但我不认为存在差异),因为我需要对它们进行某些数学运算,例如*和+。我试图用随机种子填充数组(即1337 5443,我需要使用这些)但我无法将随机变量转换为int,我无法添加或乘以随机变量。所以基本上我需要从特定种子中制作一组随机数,我还需要能够对列表中的每个元素进行数学运算。 以下是我到目前为止所做的一个例子:
import java.util.Random;
public class{
public static int a [] = new int [101];
public static void main(String[] Args){
for(int i = 0; i <= 100; i++){
Random ran1 = new Random(1337);
a [i] = ran1;//THIS IS THE PROBLEM (incompatible types)
}
int sum = a[5] + a[8] * a[10];//this won't acctually be included, it's just an example
}
}