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..

5th Aug 2016, 4:39 PM
Ahmed Shafeeu
Ahmed Shafeeu - avatar
3 Respuestas
0
yes, what u exactly need?
5th Aug 2016, 5:22 PM
Petar Suvajac
Petar Suvajac - avatar
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..
5th Aug 2016, 5:57 PM
Ahmed Shafeeu
Ahmed Shafeeu - avatar
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
5th Aug 2016, 7:46 PM
James
James - avatar