Simon Peyton-Jones wrote (in response to Hal Daume):
| basically, i want to wrap this up as something like:
|
| gengam :: RandomGen g => g -> Double -> Double -> (g, Double)
|
| analogously to the normal random # generation stuff.
There's a standard approach, originally due to Lennart Augustsson
| Say I have a foreign function:
|
| foreign import ccall "statistical_c.h gengam" c_gengam :: CDouble
-> CDouble -> IO CDouble
|
| that returns a random value parameterized by the two CDoubles.
clearly
| this must happen in IO since the return value will be different each
time,
| and some gl
> What were you planning on doing with the "g" parameter?
Well, one thought would be to use some type class magicery to try to use
this to ensure linearity, but I have no idea how to go about that.
Another thing that had crossed my mind was to use unsafeInterleaveIO to
generate an infinite list
On Fri, 2004-06-25 at 12:42, Hal Daume III wrote:
> Hi All --
>
> Say I have a foreign function:
>
> foreign import ccall "statistical_c.h gengam" c_gengam :: CDouble -> CDouble ->
> IO CDouble
>
> that returns a random value parameterized by the two CDoubles. clearly
> this must happen i
Hal Daume III wrote:
> Say I have a foreign function:
>
> foreign import ccall "statistical_c.h gengam" c_gengam :: CDouble -> CDouble ->
> IO CDouble
>
> that returns a random value parameterized by the two CDoubles. clearly
> this must happen in IO since the return value will be differ
Hi All --
Say I have a foreign function:
foreign import ccall "statistical_c.h gengam" c_gengam :: CDouble -> CDouble -> IO
CDouble
that returns a random value parameterized by the two CDoubles. clearly
this must happen in IO since the return value will be different each time,
and some g