Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

random numbers generators

Posted on 1998-11-17
8
Medium Priority
?
245 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
  • 4
  • 3
8 Comments
 
LVL 85

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
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.

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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

916 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