Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

random numbers generators

Posted on 1998-11-17
8
Medium Priority
?
243 Views
Last Modified: 2010-03-04
Where can I find a script in Perl that generate random numbers for a web page?

Thanks
0
Comment
Question by:wirefram
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1206332
print rand;
0
 

Author Comment

by:wirefram
ID: 1206333
Can you be a little bit more specific? I type "print rand;" where? I don't need a script or something?

0
 
LVL 2

Accepted Solution

by:
ventolin earned 80 total points
ID: 1206334
Here is a simple cgi that will print out a random number....

-Philip

______________cut here______________>
#/usr/bin/perl

# simple cgi for experts exchange

# Require Libraries.
use CGI qw(:standard);
use CGI::Carp 'fatalsToBrowser';
$CGI::POST_MAX=1024 * 100; # max 100k posts
$CGI::DISABLE_UPLOADS = 1; # no uploads

# Start the HTML
print header("-expires"=>'now');
print start_html("-title"=>'Philip s Random Number',
                "-author"=>'philip',
                "-dtd"=>'-//W3C//DTD HTML 3.2//EN',
                "-BGCOLOR"=>'#ffffff');

# init random with time or current PID
srand(time|$$);
# where it stops nobody knows... but it will be a random num from 0 to 1000
my $value = rand (1000);
# tell the browser this value
print $value;

# end the document
print end_html;

# end the script
__END__

yo adrienne!!!!



0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:wirefram
ID: 1206335
Thanks
0
 

Author Comment

by:wirefram
ID: 2355013
How can I close the question and give my points?
0
 
LVL 2

Expert Comment

by:ventolin
ID: 2357560
you already did.
0
 

Author Comment

by:wirefram
ID: 2357621
what do I have to do so my previous Q don't show any longer with <pack> next to it?

How long will they stay there? One is 6 months old!
0
 
LVL 2

Expert Comment

by:ventolin
ID: 2357634
you'll want to ask someone who runs this service (which isn't me):

http://www.experts-exchange.com/Customer_Service/Experts_Exchange/
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question