given an array of values, how should I extract an random number of these
values
a = [13, 15, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
77, 78, 79, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 92, 93, 94, 95, 96,
97, 98, 99, 100, 101, 102, 103, 104, 105, 106]
def extract_values( an_array, n)
…
return another_array of n values extracted randomly from an_array
end
I don’t know where to start …
- create an array of n random indexes from 0 to an_array.length, and
use it to extract the value
tfyh
joss