Use this if you are using igraph from R
This function provides a very efficient way to pull an integer random sample sequence from an integer interval.
sample_seq(low, high, length)
The lower limit of the interval (inclusive).
The higher limit of the interval (inclusive).
The length of the sample.
The algorithm runs in
O(length) expected time, even if
high-low is big. It is much faster (but of course less general) than
sample function of R.
An increasing numeric vector containing integers, the sample.
Gabor Csardi email@example.com
Jeffrey Scott Vitter: An Efficient Algorithm for Sequential Random Sampling, ACM Transactions on Mathematical Software, 13/1, 58–67.
rs <- sample_seq(1, 100000000, 10) rs