Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 musing on the Monastery: (6)
As of 2016-06-26 21:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (331 votes). Check out past polls.