Re: mt_strand
| From: | Jason Wong | Date: | Fri, 13 Feb 2004 10:51:54 +0000 |
| Subject: | Re: mt_strand | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177587@lists.php.net to get a copy of this message | ||
On Friday 13 February 2004 18:37, Angela K Hilton wrote:
> I could do with some pointers in using mt_strand.>
You do mean mt_srand() ?
[snip]
> mt_srand(make_seed());
Just do the above *once*, somewhere near the top of your code (anywhere before
you use mt_rand()).
Then just use mt_rand() wherever you need it, like eg:
$image = $random[mt_rand(0, count($random)-1)];
If you're just picking a random item from an array. the nice people who
develop php have provided a function to do just that, array_rand(). RTFM
before use.
> However - I'm not 100% sure how to incorporate it into my code - I have
> tried a few things but each time I break the code.
It would help if you stated exactly what you did and how your code was broken.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I've run DOOM more in the last few days than I have the last few
months. I just love debugging ;-)
(Linus Torvalds)
*/