note 41695 added to function.shuffle
| From: | bryan at mcnett dot org | Date: | Tue, 20 Apr 2004 07:35:46 +0000 |
| Subject: | note 41695 added to function.shuffle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68356@lists.php.net to get a copy of this message | ||
The technique described in the following article enables visiting each in a range of integers
exactly once, but in perceptually random order. A reprint of this article appears in Graphics Gems:
http://www.mactech.com/articles/mactech/Vol.06/06.12/SafeDissolve/
It's possible to cheaply permute the order of integers so produced with XOR et al. This may
enable random shuffling of arrays with less guarantee of true randomness, but more guarantee that
the output looks different from the input, which is probably what you want.
The above technique belongs to the family of LFR (Linear Feedback Registers), which have a long
history of providing "enough randomness" at very low cost.
----
Manual Page -- http://www.php.net/manual/en/function.shuffle.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41695
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41695&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41695&report=yes
Search -- http://master.php.net/manage/user-notes.php