Hi I have a snippt of my Homework ...and I am getting a different value from what I should be expecting here are my class variables
I have : seed ....(through scanner should be : 12345 -testing value so I get get the same results as my instructor-) LenghtOfArray ....(through scanner too) Final MAX = 8;
I didn't know how to coordonate within my code to get it to work
and I have the for loop :
Random Obj = new Random (seed);
int []myArray = new int [LengthOfArray];
for(int i = 0 ; i < myRandomArray.length ; i++)
{
myArray[i] = (int) Obj.nextLong();
System.out.print(myArray[i] + " ");
}
System.out.println();
Now I am missing MAX variable so my output should be : 4 4 6 0 4 4 7 0 7 6 5 6
but I get this : -70013384 64862043 543438317 1940859862 924168001 1943285380 -62817581 -1920529480 541298859 -1439409345 520340403 -1293274375
so how can I enforce my code to get the out come in the range of my MAX (which is < 8)
Aucun commentaire:
Enregistrer un commentaire