Random order
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * Posted to newsgroup by Rich Ulrich. > Thanks. I've gotten it to work, but is there a way to generate > random numbers without replacement? > This makes one of your shorter Input Programs: In order to randomize a fixed range of 1-N -- Input Program. Loop IDnum= 1 to N. Compute xxxran= uniform(1). End case. End loop. end input program. sort cases by xxxran. save outfile=* /keep= idnum. *comment - this creates a randomized list, 1-N (or whatever), * and you can use it by doing a MATCH without giving any * variables to match BY (ordinarily an nasty prospect, but OK!). match files file=* /file='needs_id.sav' . -- Rich Ulrich, wpilib@pitt.edu http://www.pitt.edu/~wpilib/index.html |
Related pages
...