Hello Brian;

This also works:

  f =: 3 :' ?(0"0) y'

or
 f =: ? @(0"0)

Brian Schott wrote:
You need f=:     3 : 'y * ?(#y)#0'2 3


because ?0 produces a scalar result.

On Mon, Jun 30, 2008 at 10:46 AM, Benoît Roesslinger <[EMAIL PROTECTED]> wrote:
Hi,

I am new to J and when doing some experiments with random number generation
I stumbled across the following behavior, which wasn't what I'd expect :

  f=: 3 : 'y * ?0'
  f 3
2.91414
  f 3
0.139888
  f 3
0.990328

OK so far, but when I tried:

  f 3 3

it gives me :

0.0403801 0.0403801 (same values!)

whereas I'd expect a behavior much like the one of '?'...
Is this behavior normal ?
Suppose I want to create a function to generate a random deviate from a
distribution (normal for instance) with some parameters (mean and sd for
instance) that will work in the same fashion as '?', ie it is possible to
generate lots of random deviates at once using code such as : distri 100 $
x, where x would represent parameters, what is the best way to go ?

Many thanks in advance!

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





--
------------------------------------------------------------------------
|\/| Randy A MacDonald       | APL: If you can say it, it's done.. (ram)
|/\| ramacd <at> nbnet.nb.ca |
|\ |                         | The only real problem with APL is that
BSc(Math) UNBF'83            | it is "still ahead of its time."
Sapere Aude                  |     - Morten Kromberg
Natural Born APL'er          |
-----------------------------------------------------(INTP)----{ gnat }-



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

Reply via email to