ruby - How do I populate an array with random numbers? -
I'm trying to populate an array of four elements with an integer less than 9.
Here is my code:
generated_number = Array.new (4) #create 4 array_number.each empty size. Random | # Random numbers for each condition in the array make Random = RAND (10) The generated_number I do not know what I'm missing.
you rand () Array.new can pass a limit (4) {rand (1 ... 9)}
Comments
Post a Comment