From 4e3e4e1ccc60331ff8ff4c1c139e9da3c95e2272 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 24 Aug 2015 06:37:19 -0700 Subject: New function: shuffle. * eval.c (eval_init): Register shuffle as intrinsic. * lib.c (shuffle): New function. * lib.h (shuffle): Declared. --- txr.1 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index 33fe9c35..374e1f31 100644 --- a/txr.1 +++ b/txr.1 @@ -19544,6 +19544,27 @@ For strings and vectors, .code sort is not stable. +.coNP Function @ shuffle +.synb +.mets (shuffle << sequence ) +.syne +.desc +The +.code shuffle +function pseudo-randomly rearranges the elements of +.metn sequence . +This is performed in place: +.meta sequence +object is modified. + +The return value is +.meta sequence +itself. + +The rearrangement depends on pseudo-random numbers obtained from the +.code rand +function. + .coNP Function @ sort-group .synb .mets (sort-group < sequence >> [ keyfun <> [ lessfun ]]) -- cgit v1.2.3