RE: [PHP] random array sort
| From: | Mike At Spy | Date: | Tue, 10 Sep 2002 14:54:01 +0000 |
| Subject: | RE: [PHP] random array sort | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115855@lists.php.net to get a copy of this message | ||
From what I understand about array_rand() and the example in the manual, it
does only pull one of each element of the array. You could easily set up a
script to compare what it is pulling to what the array you putting it into
currently has in it if it didn't.
-Mike
> -----Original Message-----
> From: David Rice [mailto:davidarice@mac.com]
> Sent: Tuesday, September 10, 2002 10:49 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] random array sort
>
>
> But if array_rand() truly pulls out random keys, how do you guarantee
> that you are not randomly pulling out the same key as you iterate
> through the array?
>
> Perhaps you could set the number of keys to return, to the size of the
> array, and somehow, magically, all the keys would be included in the
> returned array of keys.
> i.e. array_rand ( array , array_size)
> I have no idea what this would produce...
> -David
>
> On Tuesday, September 10, 2002, at 10:33 AM, Mike At Spy wrote:
>
> >
> > You could use array_rand() to take stuff out of the array at random and
> > then
> > stuff it all back into another array.
> >
> > -Mike
> >
> >
> >
> >> -----Original Message-----
> >> From: ROBERT MCPEAK [mailto:RMCPEAK@jhuccp.org]
> >> Sent: Tuesday, September 10, 2002 10:22 AM
> >> To: php-general@lists.php.net
> >> Subject: [PHP] random array sort
> >>
> >>
> >> Could someone show me a quick and simple way to randomly sort array
> >> elements? I can't seem to pinpoint the correct parameters in the docs.
> >>
> >> Thanks!
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>