A quick idea on my way out the door.

create a vector of N 1's

N#1

add a random vector of N 0's and a single 1

(i.=?)N

Sum the new vector V'  and exit if +/V' is equal to Q (probably a converging 
power conjunction)

Cheers, bob

On May 8, 2015, at 9:47 AM, Dan Bron <[email protected]> wrote:

> I think you've got a model in your head where Q=N; in that case, yes, your
> function should produce N#1 .  But N and Q are independent variables.
> 
> -Dan
> 
> ----- Original Message ---------------
> 
> Subject: Re: [Jprogramming] Random distribution
>   From: "'Pascal Jasmin' via Programming" <[email protected]>
>   Date: Fri, 8 May 2015 16:27:33 +0000 (UTC)
>     To: "[email protected]" <[email protected]>
> 
> For Q = 3, 
> 
> only 1 1 1 would match your criteria
> 
> for Q = 4,
> 2 2 would not be N=#V
> 
> 1 1 1 1 again appears to be the only match I see.
> 
> 
> ----- 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
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to