Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: Get your Bumpers ready!



Hi all,

On 17-Nov-97 Craig Oda wrote:
> How does one get really random numbers in a certain range under
>Linux, preferrably with Java?

No idea how to do it with Java but with Perl:

#!/usr/bin/perl
srand( time() ^ ($$ + ($$ << 15)) );
# get the number of TLUGers present
print "How many cool dudes are here? "; $cooldudes = <STDIN>;

# enter that number into an array
@example.com=(0..$cooldudes);

#get a whole number from @example.com 
$win = int(rand@example.com) +1 ;

#print the random number
print "Give number $win a sticker.\n";
exit

works as a one off. If any of you programming types can tell me how to get this
to work again with $win taken out of @example.com I'd sure appreciate it. 

Thanks Craig, you gave me an excuse to open my Perl books;-)

Jim S.

----------------------------------
Jim Schweizer <schweiz@example.com> 
sent this on 17-Nov-97 at 22:44:00
... My pants just went on a wild rampage through a Long Island Bowling
Alley!!
http://www1.harenet.or.jp/~schweiz/
----------------------------------
---------------------------------------------------------------
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



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links