|
Posted by Rik on 03/11/07 08:20
kevincw01 <kevin@netkev.com> wrote:
> Anyone have a clever way to retrieve for example, items 0-29 from an
> array of size N>29, in random order? The catch is that I dont want to=
> print any items more than once and I dont want to miss any.
>
> This is for a tag cloud where I have sorted them by popularity but now=
> I need to display only the top 30. I do this now but they are in
> order of popularity and its not really a 'cloud'. If I could retrieve=
> the top 30 in some random order, it would look better.
$array =3D array(....something..);
$top =3D array_splice(0,30,$array);
shuffle($top);
Where are you getting your data from? Seems it might be better to not ha=
ve =
this in the array to begin with.
-- =
Rik Wasmus
Posted on Usenet, not any forum you might see this in.
Ask Smart Questions: http://tinyurl.com/anel
Navigation:
[Reply to this message]
|