0
Is there any way that I can fill a big array using the numbers of a small array.. Bigger array can have repetitives from the smaller array..
3 Respostas
0
yes, what u exactly need?
0
I have 2 arrays of2 fixed size, bigger array is empty and smaller array is filled with random integers... Now I want to randomly fill the bigger array using the numbers in the smaller array... Doesn't matter if bigger array has repetitives from the smaller array..
0
Gave you the answer to this before but I'll write it again, this time without random I guess? create a for loop
for(int j = 0; j < bigArray.length; j++)
if(j >= littleArray.length)
bigArray[j] = littleArray[j - littleArray.length];
else
bigArray[j] = littleArray[j];
Edited for an error:
I don't like this version as much so I'll write the random one again Incase you just didn't grasp the concept.
for(int j = 0; j < bigArray.length; j++)
bigArray[j] = littleArray[rand.nextInt(littleArray.length)];
easier with that version