Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: tlug: Get your Bumpers ready!
- To: Craig Oda <craig@example.com>
- Subject: Re: tlug: Get your Bumpers ready!
- From: Jim Schweizer <schweiz@example.com>
- Date: Tue, 18 Nov 1997 21:20:13 +0900 (JST)
- Cc: tlug@example.com
- Content-Transfer-Encoding: 8bit
- Content-Type: text/plain; charset=us-ascii
- In-Reply-To: <Pine.LNX.3.96.971118105418.3895F-100000@example.com>
- Organization: JPS Solutions
- Reply-To: tlug@example.com
- Sender: owner-tlug@example.com
Hi Craig, On 18-Nov-97 Craig Oda wrote: >> # enter that number into an array >> @example.com=(0..$cooldudes); >> >> #get a whole number from @example.com >> $win = int(rand@example.com) +1 ; >this looks good. I'm wondering how Perl specifies the range. The range should be set by the contents of the array @example.com >If the random number is out of range, does it do a recalculation >of the random number? In this case, Perl isn't being asked to generate a 'random' number but is being instructed to randomly select an element from the array based on a random number generator. >Also, what does it use for the salt, >the system clock? The salt is generated via the clock and the rand() operator. >From the Nutshell Camel book: -------------------------------- srand EXPR This function sets the random number seed for the rand operator. If EXPR is omitted, it does srand(time), which is pretty predictable, so don't use it for security type things, such as random password generation. -------------------------------- The authors suggest using: srand( time() ^ ($$ + ($$ << 15)) ); There's also a Math::TrulyRandom module on CPAN, but I've never messed with it. I've used rand() a couple of times on web pages where I wanted to get a randomly selected image to load. Blaine's comment that setting the array means that 'true' randomness is unachievable is correct. Basically, I was playing with the assumption that 'pulling a name out of a hat' was the goal. >Ahh, to use hitech or lotech that is the question. Which is >more random? Use whatever is the most fun.... --------------------------------------------------------------- TLUG Meeting Dec. 13, 12:30 at Tokyo station Yaesu Chuo ticket gate 13:30 Starbuck's coffee. 13:45 HSBC | info: joem@example.com At least 3 functional Sparc IPC machines will be raffled out --------------------------------------------------------------- a word from the sponsor: TWICS - Japan's First Public-Access Internet System www.twics.com info@example.com Tel:03-3351-5977 Fax:03-3353-6096
- Follow-Ups:
- Re: tlug: Get your Bumpers ready!
- From: "Alan B. Stone" <stoneab@example.com>
- References:
- Re: tlug: Get your Bumpers ready!
- From: Craig Oda <craig@example.com>
Home | Main Index | Thread Index
- Prev by Date: tlug: Meeting Announcement on linux-users ML
- Next by Date: Re: tlug: Get your Bumpers ready!
- Prev by thread: Re: tlug: Get your Bumpers ready!
- Next by thread: Re: tlug: Get your Bumpers ready!
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links