, , , .
. , , : , ex ante ? , , .
, RNG: Windows 32768 .
:
use strict; use warnings;
use List::Util qw( sum );
my @projects = map { mk_project() } 1 .. 1_000;
for my $i (1 .. 10) {
my $r = rand;
my @profits = map { $_->($r) } @projects;
my $avg_profits = sum( @profits ) / @profits;
my $n_profitable = grep { $_ >= 0 } @profits;
print "Profits: $avg_profits\tProfitable: $n_profitable\n";
}
sub mk_project {
my $m = rand;
return sub {
my ($r) = @_;
return 10*($r - $m);
}
}