![]() |
PING
0.9
Statistical data handling and processing in production environment
|
Perform a pseudo-random permutation of either the elements of a list or a sequence of integers.
par : input parameter; this can be:seed : (option) seed of the pseudo-random numbers generator; if seed<=0, the time of day is used to initialize the seed stream; default: seed=0; see %ranuni;mark, sep : (option) characters/strings used respectively as a "quote" and a separator in the input list; default: mark=str(%"), and" sep=%quote(,), i.e. the input clist is a comma-separated list of quote-enhanced items; see %clist_unquote for further details._clist_ : output sequenced list, i.e. the length of the considered list (calculated as the number of strings separated by sep).
Using a fixed seed, it is possible to retrieve pseudo-random lists (sequence) of INTEGER values, e.g.:
(always) returns olist=9 10 1 4 3 8 7 5 6 2, while using the same seed over some lists of NUMERIC or CHAR lists enables us to permute the items of the lists, e.g.:
return always the same lists olist=i j a d c h g e f b and alist=1 0 -2 56 43 10 8.2 89 0.5 105.
Run macro %_example_list_permutation for examples.
%list_compare(&par, &olist)=0 holds.$ appears somewhere in the list. If you need to use $, you can reset the global macro variable G_PING_UNLIKELY_CHAR (see _setup_ file) to another dumb (unlikely) character of your own.