A side remark: There are some unnecessary allocations in your code. You can just use 1:10 instead of collect(1:10). And rand(1:10, 10) also creates a vector that it not really needed.
I’m not sure if you want a vector with 10 or with 100 elements as the result. In the first case you can say