Solved

random numbers generators

Posted on 1998-11-17
8
199 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 84

Expert Comment

by:ozo
Comment Utility
print rand;
0
 

Author Comment

by:wirefram
Comment Utility
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 20 total points
Comment Utility
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
 

Author Comment

by:wirefram
Comment Utility
Thanks
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

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

Expert Comment

by:ventolin
Comment Utility
you already did.
0
 

Author Comment

by:wirefram
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Perl script to parse log and delete the file 17 170
HTTP Error 502.2 - Bad Gateway 3 195
Regular Expression for URL 10 79
Perl Frameworks 1 51
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now