mglib

Personal IDL library for M. Galloy

single page | use frames     summary     class     fields     routine details     file attributes

analysis/

mg_sample.pro

includes main-level program

Routines

top mg_sample

result = mg_sample(nValues, nIndices [, seed=integer or lonarr(36)])

Get nIndices random indices for an array of size nValues (without repeating an index).

Return value

lonarr(nIndices)

Parameters

nValues in required type=long

size of array to choose indices from

nIndices in required type=long

number of indices needed

Keywords

seed in out optional type=integer or lonarr(36)

seed to use for random number generation, leave undefined to use a seed generated from the system clock; new seed will be output

Examples

Try:

IDL> r = randomu(seed, 10) IDL> print, r, format='(4F)' 0.6297589 0.7815896 0.2508559 0.7546844 0.1353382 0.1245834 0.8733745 0.0753110 0.8054136 0.9513228 IDL> ind = mg_sample(10, 3, seed=seed) IDL> print, ind 2 4 7 IDL> print, r[ind] 0.250856 0.135338 0.0753110

Other attributes

Requires:

IDL 8.0

File attributes

Modification date: Wed May 14 15:07:14 2014
Lines: 21
Docformat: rst rst
Personal library of Michael Galloy
Contact me if you have enhancement requests or bug fixes.