Chris wrote:
That works, but shuffle() is cleaner and then you can echo things
out with a foreach() expression.
http://www.php.net/manual/en/function.shuffle.php
If you're doing a shuffle inside a loop, it's going to be even slower.
Might not be an issue for the OP but after your array gets
Reese wrote:
Andrew Barnett wrote:
I ended up using an example from the PHP website.
Just extended the array to the number of lines I needed.
That works, but shuffle() is cleaner and then you can echo things
out with a foreach() expression.
http://www.php.net/manual/en/function.shuffle.php
Andrew Barnett wrote:
I ended up using an example from the PHP website.
Just extended the array to the number of lines I needed.
That works, but shuffle() is cleaner and then you can echo things
out with a foreach() expression.
http://www.php.net/manual/en/function.shuffle.php
Reese
--
P
Andrew Barnett wrote:
I ended up using an example from the PHP website.
You're randomizing the whole array which when it gets large, will be
noticeable.
If you're using zero based arrays (like above - 'Neo' is item '0',
'Morpheus' is item '1'), I'd suggest something like this:
$input = a
I ended up using an example from the PHP website.
Just extended the array to the number of lines I needed.
Andrew
Andrew Barnett wrote:
Hey All,
I'm trying to work out how to randomise the order of a bunch of strings I
have. I know how to pick one random string from a bunch of them, but how do
I make sure that everyone is used just once.
$used_strings = array();
while (true) {
$string = get_random_string
On Thu, Oct 16, 2008 at 8:22 PM, Andrew Barnett <[EMAIL PROTECTED]>wrote:
> Hey All,
> I'm trying to work out how to randomise the order of a bunch of strings I
> have. I know how to pick one random string from a bunch of them, but how do
> I make sure that everyone is used just once.
>
> Any poin
7 matches
Mail list logo