|
Posted by geoffp on 09/28/51 11:57
"Tim Roberts" <timr@probo.com> wrote in message
news:v8gpf211m537rbitnonp10j935vetoenfd@4ax.com...
> "geoffp" <fwerfrf@jhgjhfggb.com> wrote:
>
....
>
> and it produces the same sequence every time. Note that you can't rely on
> the sequence continuing across pages.
>
>>By the way, seeding mt_srand with different integers doesn't necessarily
>>produce different series. I've done a little testing and every pair of
>>consecutive even and odd numbers produces the same series. eg. seed 0 and
>>1
>>produce the same series, as does 10000 and 10001.
>
> You are correct. The code for mt_srand always sets the bottom bit.
> --
> - Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.
Thanks Tim - I think I see whats happening.
I naively assumed that once srand had been seeded, the series would
continue for the whole session(I set it in the first page). From what you
say I gather
that the series ends whenever you call a page, even though its got the same
PHP code. Then the randomiser is seeded automatically the first time its
called - DOH!
Geoff
PS Some of my posts to this group don't seem to be appearing, so apologies
if you've got this twice. I don't often use newsgroups.
Navigation:
[Reply to this message]
|