IDL> array = [1.0,2.9,3.8,4.7,5.6,6.5,7.4,8.3,9.2,10.1] ; 10个数的数组
IDL> selectCount = round( n_elements(array) * 0.8) ; 选择数组个数的80%的数量
IDL> print, selectCount
8
IDL> randSeed = randomu(seed, selectCount) ; 产生一组随机数
IDL> print, randSeed
0.831052 0.592748 0.420056 0.829211 0.281111 0.0661612 0.370031 0.223807
IDL> seedIndex = sort(randomu(seed, selectCount)) ; 对随机数排序, 获得排序结果的索引
IDL> print, seedIndex
2 5 7 6 1 3 0 4
IDL> print, array[seedIndex] ; 获得随机选取的80%的元素
3.80000 6.50000 8.30000 7.40000 2.90000 4.70000 1.00000 5.60000