You can just make an assignment statement after the creation of the random number (y). You should assign y to an index of your array.