igraph.sample

0th

Percentile

Sampling a random integer sequence

This function provides a very efficient way to pull an integer random sample sequence from an integer interval.

Keywords
datagen
Usage
igraph.sample(low, high, length)
Arguments
low
The lower limit of the interval (inclusive).
high
The higher limit of the interval (inclusive).
length
The length of the sample.
Details

The algorithm runs in O(length) expected time, even if high-low is big. It is much faster (but of course less general) than the builtin sample function of R.

Value

  • An increasing numeric vector containing integers, the sample.

References

Jeffrey Scott Vitter: An Efficient Algorithm for Sequential Random Sampling, ACM Transactions on Mathematical Software, 13/1, 58--67.

Aliases
  • igraph.sample
Examples
rs <- igraph.sample(1, 100000000, 10)
rs
Documentation reproduced from package igraph, version 0.1.2, License: GPL version 2 or later (June, 1991)

Community examples

Looks like there are no examples yet.