Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

RE (2): Need help with number generator

by tilly (Archbishop)
on Aug 10, 2000 at 15:43 UTC ( [id://27266]=note: print w/replies, xml ) Need Help??


in reply to RE: Need help with number generator
in thread Need help with number generator

You probably missed that your question was put at How do I get random numbers that follow standard distribution? in Categorized Questions and Answers.

There are several answers there, including mine at Re: How do I get random numbers that follow standard distribution?.

UPDATE
After talking with you I found that you have two rather irritating conditions. You cannot easily install modules, and you want to skew the output. Here is some sample code that gives you an idea how to do that, but I am warning you that it will take a lot of playing around to get this to produce what you want...

my @weights = qw(0.5 1 2); my @random = sort {$a <=> $b} map{rand()} 0..$#weights; my $tot; foreach (0..$#weights) { $tot += $random[$_] * $weights[$_]; } print $tot;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://27266]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-18 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found