diff options
-rw-r--r-- | share/txr/stdlib/quips.tl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/share/txr/stdlib/quips.tl b/share/txr/stdlib/quips.tl index c509e981..89b01b72 100644 --- a/share/txr/stdlib/quips.tl +++ b/share/txr/stdlib/quips.tl @@ -79,5 +79,10 @@ (defparml sys:%quip-rand-state% (make-random-state)) +(defvarl sys:%shuffled-quips%) + (defun quip () - [sys:%quips% (rand (len sys:%quips%) sys:%quip-rand-state%)]) + (unless sys:%shuffled-quips% + (let ((*random-state* sys:%quip-rand-state%)) + (set sys:%shuffled-quips% (shuffle sys:%quips%)))) + (pop sys:%shuffled-quips%)) |