Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Near equal partitions.

by syphilis (Chancellor)
on Jan 14, 2011 at 05:14 UTC ( #882285=note: print w/ replies, xml ) Need Help??


in reply to Near equal partitions.

I'd probably do something like:
sub part { use POSIX qw(ceil); my ($n, $m) = @_; my @parts; for(0 .. $m - 1) { $n -= $parts[$_] = ceil($n / $m); $m -= 1; } return @parts; }
Cheers,
Rob

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2016-07-23 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (221 votes). Check out past polls.