Trivially speaking, AIX goes past 32k PID numbers as well. I believe that
v4r3 allows 32k open files per process as well. If anyone would care for
detail (and why would you???) email me at [EMAIL PROTECTED] instead of
the list so that I can look it up, and I can try to stay in topic. =)
G. Armstrong
Lost .sig in format
-----Original Message-----
From: Walt Mankowski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 11, 2001 12:50 AM
To: [EMAIL PROTECTED]
Subject: Re: Hi, what time() ^ $$ means?
On Wed, Jul 11, 2001 at 12:34:37AM -0400, Walt Mankowski wrote:
> On Tue, Jul 10, 2001 at 07:27:04PM -0700, Erik W wrote:
> > $$<<15 ???
>
> This shifts the value of $$ 15 bits to the left, which is the same as
> multiplying $$ by 2**15.
I forgot to reference the code you were referring to:
>> time() ^ ($$ + ($$ << 15))
The reason they're shifting $$ 15 bits to the left is that they're
assuming that the process id (which is what $$ is) is a 15-bit
integer. This has been traditionally true in Unix, but I believe I've
read about some support in recent Linux kernels for >32767 processes.
Once they leftshift it 15 bytes, the rightmost 15 bytes are 0. By
adding $$ to it they fill in those empty bytes with $$ again. The
result is a 30-bit number consisting of the bits in $$ repeated twice.
There are better methods of seeding random number generators, so this
method is mainly of educational and historical interest. As Jeff
mentioned, in modern perls rand() will call srand() automatically the
first time it's called.
Walt