Re: [PHP] Rand() problem

2004-01-11 Thread Jon
PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, January 10, 2004 5:26 AM Subject: Re: [PHP] Rand() problem Hello nefar, Friday, January 9, 2004, 6:05:34 AM, you wrote: n After moving my PHP files to a new hard drive and a new windows n installation, my rand function gets stuck and only gives you

Re: [PHP] Rand() problem

2004-01-11 Thread Jason Wong
On Monday 12 January 2004 12:30, Jon wrote: I am running the latest stable PHP release. Which is? Latest changes over time. Always state the exact version. I am passed values and my range is far less than the max... On my computer with my Xitami webserver this code returns the number 45

[PHP] Rand() problem

2004-01-10 Thread nefar
After moving my PHP files to a new hard drive and a new windows installation, my rand function gets stuck and only gives you one number over and over. It worked a few times then got stuck. I tried using IIS 5.1 (I was using Xitami) and it gave me the same results. It even gets stuck on the same

Re: [PHP] Rand() problem

2004-01-10 Thread Richard Davey
Hello nefar, Friday, January 9, 2004, 6:05:34 AM, you wrote: n After moving my PHP files to a new hard drive and a new windows n installation, my rand function gets stuck and only gives you one number over n and over. It worked a few times then got stuck. I tried using IIS 5.1 (I n was using

[PHP] rand(min, max) always returns min

2003-12-15 Thread Jeff Mainville
Howdy, I've seen this topic posted once before, but without ever reaching a conclusion. The earlier posting is at http://marc.theaimsgroup.com/?l=php-generalm=105414659615227w=3 The problem: rand(min, max) always returns min on some systems. rand(), mt_rand, and mt_rand(min, max) all work

Re: [PHP] rand() function not working right

2003-08-31 Thread john
[EMAIL PROTECTED] Sent: Thursday, May 29, 2003 4:29 AM Subject: [PHP] rand() function not working right I'm using the latest php and the rand() function isn't working properly when giving it any min and max arguments. It does work without anything between the () but if I put a min and max

Re: [PHP] rand() function not working right

2003-08-31 Thread John T. Beresford
101 for $x i changed to mt_rand(1,173); and that always returns 142 ??? weirdness .. dont tell me this is happening to only me? - Original Message - From: [EMAIL PROTECTED] To: php general list [EMAIL PROTECTED] Sent: Thursday, May 29, 2003 4:29 AM Subject: [PHP] rand() function

Re: [PHP] rand() function not working right

2003-08-31 Thread Curt Zirzow
* Thus wrote john ([EMAIL PROTECTED]): youre not the only one .. i just installed 4.3.3 and $x = rand(1,173); always returns 101 for $x i changed to mt_rand(1,173); and that always returns 142 ??? weirdness .. dont tell me this is happening to only me? it works find with 4.3.3RC1 on

Re: [PHP] rand() function not working right

2003-08-31 Thread john
hope not ... winxp - Original Message - From: Curt Zirzow [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, August 31, 2003 5:13 PM Subject: Re: [PHP] rand() function not working right * Thus wrote john ([EMAIL PROTECTED]): youre not the only one .. i just installed 4.3.3

[PHP] rand() function not working right

2003-05-29 Thread ldg
I'm using the latest php and the rand() function isn't working properly when giving it any min and max arguments. It does work without anything between the () but if I put a min and max, then only the min value always gets chosen. Is that a bug? Is that new? I'm not using an old php version, and

[PHP] rand/mt_rand oddity

2003-02-28 Thread David Otton
I wrote a simple function to randomize the order of an array. In pseudo-code, it looks like this : def _array_rand (a) : for i = 0 to len (a) j = rand (len (a)) temp = a[i] a[i] = a[j] a[j] = temp return(a) Can anyone tell me if I'm missing the obvious

[PHP] rand()

2002-09-03 Thread Erwin
Hi all, I'm having a problem with the rand function. I use the function below: function gen_short_primary_key_value( $maxlength = 5 ) { $mt = split( ' ', microtime(), 2 ); $foo = (double) ($mt[0] + $mt[1]) * 1; $md5 = strtoupper( md5( $foo ) ); for ( $j = 0; $j $maxlength;

[PHP] rand(0,1) does seem to get more often 1

2002-05-07 Thread andy
Hi there, I am wondering if it is possible that this function tends to be more often 1. I do get 8 of 10 times 1. srand((double)microtime()*100); if (rand(0,1) == 1){ code... it looks ok to me. Thanx for any help, Andy -- PHP General Mailing List (http://www.php.net/) To

[PHP] rand()

2002-03-13 Thread Jeff Sittler
I am wanting to use rand() to generate a number between 33-90 OR 125-146. Is there a way to do this? I don't want any numbers before 33 or between 91-124 or after 146. Could someone point me in the direction I need to look to accomplish this. Thanks, Jeff -- PHP General Mailing List

Re: [PHP] rand()

2002-03-13 Thread Jason Wong
On Thursday 14 March 2002 13:31, Jeff Sittler wrote: I am wanting to use rand() to generate a number between 33-90 OR 125-146. Is there a way to do this? I don't want any numbers before 33 or between 91-124 or after 146. Could someone point me in the direction I need to look to accomplish

RE: [PHP] rand()

2002-03-13 Thread Demitrious S. Kelly
for validity and syntax. -Original Message- From: Jeff Sittler [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 13, 2002 9:31 PM To: [EMAIL PROTECTED] Subject: [PHP] rand() I am wanting to use rand() to generate a number between 33-90 OR 125-146. Is there a way to do this? I don't want any numbers

RE: [PHP] rand()

2002-03-13 Thread Demitrious S. Kelly
] Subject: RE: [PHP] rand() Something to the effect of $num=0; do { $num=rand(33,146); if ( $num 90 $num 125 ) { $num=0; } else if ( $num 146 || $num 33 ) { $num=0; } } while ( $num == 0 ); note: ths is just off the top of my head

RE: [PHP] rand()

2002-03-13 Thread Martin Towell
$n = rand(33, 112); if ($n 90) $n += 34; not tested in code, but logically, this should work Martin -Original Message- From: Jeff Sittler [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 4:31 PM To: [EMAIL PROTECTED] Subject: [PHP] rand() I am wanting to use rand

Re: [PHP] rand()

2002-03-13 Thread Jeff Sittler
the min and max would work if I wanted the number between 33 and 146, but I am wanting to specify two ranges, not just one. Please RTFP Jeff Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Thursday 14 March 2002 13:31, Jeff Sittler wrote: I am wanting to use rand()

Re: [PHP] rand()

2002-03-13 Thread Rasmus Lerdorf
Just do the obvious: $rand = rand(33,111); $num = ($rand90) ? $rand+35 : $rand; On Wed, 13 Mar 2002, Jeff Sittler wrote: I am wanting to use rand() to generate a number between 33-90 OR 125-146. Is there a way to do this? I don't want any numbers before 33 or between 91-124 or

RE: [PHP] rand()

2002-03-13 Thread Niklas Lampén
Use two rand()'s. $foo = rand(2); if ($foo == 0) rand(first_set); else rand(second_set); Niklas -Original Message- From: Jeff Sittler [mailto:[EMAIL PROTECTED]] Sent: 14. maaliskuuta 2002 7:50 To: [EMAIL PROTECTED] Subject: Re: [PHP] rand() the min and max would

[PHP] Rand seeding

2002-01-31 Thread Zak Grant
All, I remember a patch being committed to CVS a while back which auto-seeded rand() if it hadn't been manually called already. Is this in PHP 4.1.1? If so, does it also work for mt_rand()? Thanks, ~ZG~ _ Get your FREE

[PHP] Rand function

2002-01-22 Thread Sam
Hi all, Can anyone tell me why, when I run this $number = rand (1,12); The only number that ever appears is 5? Not really a random number... Thanks Sam

Re: [PHP] Rand function

2002-01-22 Thread Jason Wong
On Tuesday 22 January 2002 18:52, Sam wrote: Hi all, Can anyone tell me why, when I run this $number = rand (1,12); The only number that ever appears is 5? Not really a random number... You need to seed the random number generator using srand(). Best to read the online annotated manual

RE: [PHP] Rand function

2002-01-22 Thread Jon Haworth
Can anyone tell me why, when I run this $number = rand (1,12); The only number that ever appears is 5? Not really a random number... You need to seed the random number generator first. http://www.php.net/srand HTH Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

RE: [PHP] rand(), mt_rand(), and my inability to make either of them random.

2001-01-26 Thread Robert Collins
;config.inc.php", $lownum, $highnum); } ? -Original Message- From: April [mailto:[EMAIL PROTECTED]] Sent: Friday, January 26, 2001 1:50 PM To: PHP General Subject: [PHP] rand(), mt_rand(), and my inability to make either of them random. I have this scriptlet: $items = 6; $randnum = ran

Re: [PHP] rand(), mt_rand(), and my inability to make either of themrandom.

2001-01-26 Thread Philip Olson
Hi April, You need to plant seeds to reach this goal, it discusses this in manual under rand() and mt_rand() so have a look here : http://www.php.net/manual/en/function.rand.php Which links to and talks about srand : http://www.php.net/manual/en/function.srand.php A seedless

Re: [PHP] rand(), mt_rand(), and my inability to make either of them random.

2001-01-26 Thread April
To: "'April'" [EMAIL PROTECTED]; "PHP General" [EMAIL PROTECTED] Sent: Friday, January 26, 2001 2:58 PM Subject: RE: [PHP] rand(), mt_rand(), and my inability to make either of them random. this is a function that I wrote to solve this problem, but it is almost impossible

Re: [PHP] rand(), mt_rand(), and my inability to make either of them random.

2001-01-26 Thread April
PROTECTED] To: "Robert Collins" [EMAIL PROTECTED]; "PHP General" [EMAIL PROTECTED] Sent: Friday, January 26, 2001 3:15 PM Subject: Re: [PHP] rand(), mt_rand(), and my inability to make either of them random. Thanks. It doesn't need to be completely random, just, more random than

[PHP] rand is not random for me :(

2001-01-10 Thread Brandon Orther
When I use random rand(1, 10) I always get 2? Thank you, Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -- PHP General Mailing List