;---------------------------------------------------------------------- ; Simple function to generate indices for sample. ; ; N = sample size ; method = 0 ==> sample *without* replacement; reshuffle the order ; mean/std/... unchanged ; use when the order of sampling may be important ; ; method = 1 ==> sample *with* replacement ; mean/std/... will change ; Generate index values that can be used for sampling ;---------------------------------------------------------------------- undef("generate_sample_indices") function generate_sample_indices(N[1], method[1]:integer) local k begin if (method.lt.0 .or. method.gt.1) then print("generate_sample_indices: method="+method+": only 0 or 1 allowed") exit end if if (method.eq.0) then k = generate_unique_indices( N ) else ;k = round(random_uniform(-0.499999,N-0.500001,N), 3) ; original k = round(random_uniform(-0.499999d0, N-0.500001d0, N), 3) end if return(k) end