How could I effectively use a 1-to-1 upward random sampling of 1: n values, making sure that each of the random sampling values ββis always higher than the previous value?
eg:.
For 1: 100 values, get a random number, say, which is 61. (current list = 61)
Then choose a different number from 62 to 100, let's say that is 90 (current list = 61.90)
Then choose a different number from 91 to 100, let's say that it is 100.
Stop the process when the maximum value has been hit (final list = 61.90,100)
I am stuck on the ground, thinking of this awkward:
a1 <- sample(1:100,1) if(a1 < 100) { a2 <- sample((a+1):100,1) } etc etc...
I want to report a finite vector that is a concatenation of a1, a2, a (n):
result <- c(a1,a2)
Even if it sounds like a homework question, it is not. I gratefully left the days of homework many years ago.
thelatemail
source share