Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
There's more than one way to do things
 
PerlMonks  

Re: Near equal partitions.

by syphilis (Canon)
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


Comment on Re: Near equal partitions.
Download Code

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 having an uproarious good time at the Monastery: (6)
As of 2014-04-19 18:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (483 votes), past polls