Subversion Repositories wimsdev

Rev

Rev 14279 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
32 reyssat 1
!! +var+ +random+ +string+
2
 
11210 bpr 3
tit:shuffle
4
type:$type_var
11220 bpr 5
alias:randperm, randpermute
14279 obado 6
syntax:!shuffle [even|odd] ``n''\
11292 bpr 7
!shuffle [even|odd] ``list''
14279 obado 8
 
9
mean:Randomly permutes a set of ``n'' elements. ``n'' must be a positive integer\
11292 bpr 10
  not greater than 1024 in the first usage, or is the number of items in ``list'' in the second\
17228 bpr 11
  usage. <br>\
11292 bpr 12
  For the first usage, the command returns a comma-separated list ``i<sub>1</sub>, i<sub>2</sub>, ...,\
13
  i<sub>n</sub>'', where the items ``i<sub>k</sub>'' are\
17228 bpr 14
  randomly ordered elements of the set ``{1,2,...,n}''. <br>\
11210 bpr 15
  This command can be used in conjunction with commands\
16
  $(ref1)cmdlist_item_&+cmd_choose=all$(ref2)cmdlist_item_">!item</a>,\
17
  $(ref1)cmdlist_line_&+cmd_choose=all$(ref2)cmdlist_line_">!line</a>,\
18
  $(ref1)cmdlist_word_&+cmd_choose=all$(ref2)cmdlist_word_">!word</a>,\
19
  $(ref1)cmdlist_char_&+cmd_choose=all$(ref2)cmdlist_char_">!char</a>,\
17228 bpr 20
  to randomly permute items, lines, words, or characters in a string. <br>\
21
  For the second usage, a new list with randomly permuted items in ``list'' is returned. <br>\
11292 bpr 22
  In any case, the variable ``wims_shuffle_order'' is set to be\
17228 bpr 23
  the list ``i<sub>1</sub>, i<sub>2</sub>, ..., i<sub>n</sub>''. <br>\
11292 bpr 24
  When the optional word ``even'' or ``odd'' is present, only even/odd permutations are produced.