Documentation for /Users/balarsen/Documents/idl/larsen/

Generated by IDLdoc

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

stats/

resample.pro

topresample

result = resample(n, tot [, SEED=SEED] [, UNIQUE=UNIQUE] [, SORT=SORT])

create a uniform resampling of indicies from 0 to n_elements()-1

indicies must be [0:n_elements()-1], will add later the ability to choose from input indicies if needed

choose random points on [0, n_elements()] then truncate them all them all, and they may or may not be all unique

Return value

rs: resampled array with n elements

Parameters

n in required

the number of points to have in the resampling

tot in required

the number of elements in the array to resample

Keywords

SEED in optional

the seed value to use in the randomu command

UNIQUE in optional

forces the return indicies to be unique within the space

SORT in optional

return the with replacement array sorted, this is the default for the unique case

Examples

print, resample(10,100) 7 12 16 22 52 60 71 73 74 87 for a "resample with replacement" make both n and tot the same print, resample(10,10) 2 9 0 4 7 7 2 3 0 2

Author information

History:

26July2007 Brian Larsen rewriten in accordance with http://www.dfanning.com/code_tips/randomindex.html which just makes it faster Thu Mar 30 15:07:20 2006, Brian Larsen added UNIQUE keyword so that you can get non unique indicies from the procedure, also fixed issues caused by rounding instead of truncating Thu Mar 16 09:40:44 2006, Brian Larsen written and tested

Statistics

Lines: 28
McCabe complexity:

File attributes

Modifcation date: Mon Sep 22 12:40:08 2008
Lines: 91