Where I have round use Devon's banker's rounding algorithm.


   'Q N' =: 50 10

   round =: 1&$: : ([ * [: <. 1r2 + %~)
   assert (-: 4 round i.@#) 0 0 4 4 4 4 8

   R =: ?@:(#&0) N

   V =: Q ([: round (*(%+/))) R

   +/V
51

----- Original Message -----
From: Dan Bron<[email protected]>
To:[email protected]
Cc:
Sent: Friday, May 8, 2015 11:54 AM
Subject: [Jprogramming] Random distribution

I have a quantity Q and I want to divide it into a vector V of N
randomly-sized chunks, such that N=#V and Q=+/V .

Ideas?

-Dan


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to