in reply to build a distribution
Depends. Does your data still fit into memory? Do you need the distributions more than once or do you just stuff them into some statistics package or chart generator? Do you need the individual numbers in a bin or only the count? Do you know the different distributions you want beforehand or do you want interactivly change the lengths? Do you need more than one distribution simultaneously or is only the last distribution relevant?
The following code deals with the simplest case:
sub finddistribution { my ($length, $numref)= @_; my @counts; foreach my $num (@$numref) { $counts[$num/$length]++; } return @counts; } ... my @dezimaldistri= finddistribution(10,\@nums);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: build a distribution
by Grig (Novice) on Aug 07, 2010 at 14:28 UTC |