----- Original Message ----- 
From: "Katie Dewees" <[EMAIL PROTECTED]>
To: "Jake McHenry" <[EMAIL PROTECTED]>
Sent: Friday, January 16, 2004 4:44 PM
Subject: RE: [PHP] odd and even numbers


> Can you just set a value somewhere (in a flat file, or a database) to 1 or
> 2. 1 can represent person number 1, 2 person number 2. Check the value
every
> time you deliver an e-mail to see who gets it, and then switch it to the
> other one.
>
> Katie Dewees
> Web Developer
> E-mail: [EMAIL PROTECTED]
>
> -----Original Message-----
> From: Jake McHenry [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 16, 2004 3:42 PM
> To: joel boonstra
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] odd and even numbers
>
>
> ----- Original Message -----
> From: "joel boonstra" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, January 16, 2004 3:35 PM
> Subject: Re: [PHP] odd and even numbers
>
>
> > On Fri, Jan 16, 2004 at 02:30:59PM -0600, Jeremy wrote:
> > > function isOdd ($value) {
> > > return (int)$value % 2 ? true : false;
> > > }
> > >
> > > Returns true/false if the value is odd. Also rounds down floating
point
> numbers given as the test value.
> >
> > No need to explicitly state "true" and "false".  Just negate the result
> > of your modulus operator, and take advantage of the fact that "0" is
> > false, and "1" is true:
> >
> > function isOdd ($value) {
> >   return !((int)$value % 2);
> > }
> >
> > --
> > [ joel boonstra | gospelcom.net ]
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> This worked.. somewhat.. here is what I want to do though.
>
> I have two people checking the same email address. I want to break up the
> emails 50/50 to each person. What values can I put into the random number
> generator so that I can get closer to 50/50. I just set up a test page
with:
>
> $rand = rand(1, 501);
>
> echo $rand;
>
> if ($rand % 2 == 0)
>   echo "even";
> else
>   echo "odd";
>
>
> and I'm getting a lot more evens than odds, so the one person would get
more
> emails than the other. Is there any substitution to rand that I could use
to
> get one message to go to one person, then the next to the other? I'd like
it
> to be as close to 50/50 as possible.
>
> any questions, let me know
>
> Thanks,
> Jake
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


I could, but I didn't really want to. I just wanted a quick fix... I was
going to do that before, just wanted to see if anyone knew of another route.

Thanks,
Jake

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to