in reply to list of random numbers with given avarage
perl -e'@a=split//," \n/)\"={\"";print $a[$_] for split//,"00002731000223155264555102401"'#!/usr/bin/perl -w use strict; use Data::Dumper; sub rand_list { my ($howmany, $min, $max, @a) = (@_, ()); push @a, rand($max-$min)+$min for 1..$howmany; @a; } sub avg_list { my ($c, $t) = (0, 0); $t+=pop, $c++ while @_; ($t / $c) } my @b = rand_list(100, 1, 5); # 100 nums between 1 and 5 print Dumper(\@b);
|
|---|