[Haskell-cafe] good choice for random number generator ?

23 views
Skip to first unread message

bri...@aracnet.com

unread,
Jul 24, 2016, 7:48:27 PM7/24/16
to haskel...@haskell.org
There's quite a few. Many are very old.

I would have like to use vector-random and got this :

Data/Vector/Random/Mersenne.hs:33:18:
Could not find module ‘Data.Vector.Fusion.Stream’
It is a member of the hidden package ‘vector-0.10.12.3@vecto_1COyUuV1LrA1IjYnWfJnbs’.
Perhaps you need to add ‘vector’ to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.

Data/Vector/Random/Mersenne.hs:35:18:
Could not find module ‘Data.Vector.Fusion.Stream.Size’
It is a member of the hidden package ‘vector-0.10.12.3@vecto_1COyUuV1LrA1IjYnWfJnbs’.
Perhaps you need to add ‘vector’ to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.

I wouldn't be opposed to fixing it, but I'm wondering at this point there isn't a better package to use instead.

I'm looking for both integer and floating point random numbers, uniform and gaussian.

gsl-random looks promising as does mwc-random.

any other suggestions ?

Thanks,

Brian
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

Erik de Castro Lopo

unread,
Jul 25, 2016, 7:19:46 AM7/25/16
to haskel...@haskell.org
bri...@aracnet.com wrote:

> Data/Vector/Random/Mersenne.hs:33:18:
> Could not find module ‘Data.Vector.Fusion.Stream’
> It is a member of the hidden package ‘vector-0.10.12.3@vecto_1COyUuV1LrA1IjYnWfJnbs’.
> Perhaps you need to add ‘vector’ to the build-depends in your .cabal file.

Have you tried adding the vector package to the build-depends to you
cabal file as suggested in that error message?

Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/

Oleg Grenrus

unread,
Jul 25, 2016, 7:25:56 AM7/25/16
to bri...@aracnet.com, haskel...@haskell.org
I added vector-random to matrix.h.h.o build queue [1]:

Will check whether it have some problems, and report here & upstream

Oleg

signature.asc

Albert Y. C. Lai

unread,
Jul 25, 2016, 3:13:21 PM7/25/16
to haskel...@haskell.org
On 2016-07-24 07:48 PM, bri...@aracnet.com wrote:
> I'm looking for both integer and floating point random numbers, uniform and gaussian.
>
> gsl-random looks promising as does mwc-random.
>
> any other suggestions ?

I like tf-random for its functional interface and splittable design. But
I have only judged subjectively. And it only does uniform.

Oleg Grenrus

unread,
Jul 25, 2016, 3:30:42 PM7/25/16
to bri...@aracnet.com, haskell-cafe
Seems that `vector-random-0.2` is incompatible with new fusion implementation of `vector-0.11`
Also due “recent” GHC being more strict about pragmas, build fails for all GHC >=7.2

Data/Vector/Random/Mersenne.hs:85:5:
The INLINE pragma for default method `random' lacks an accompanying binding

I edited bounds on Hackage to disallow invalid build-plans.

- Oleg
signature.asc

bri...@aracnet.com

unread,
Jul 26, 2016, 12:33:41 AM7/26/16
to haskel...@haskell.org
On Mon, 25 Jul 2016 21:19:39 +1000
Erik de Castro Lopo <mle...@mega-nerd.com> wrote:

> bri...@aracnet.com wrote:
>
> > Data/Vector/Random/Mersenne.hs:33:18:
> > Could not find module ‘Data.Vector.Fusion.Stream’
> > It is a member of the hidden package ‘vector-0.10.12.3@vecto_1COyUuV1LrA1IjYnWfJnbs’.
> > Perhaps you need to add ‘vector’ to the build-depends in your .cabal file.
>
> Have you tried adding the vector package to the build-depends to you
> cabal file as suggested in that error message?
>

No. it looked very old and out-of-date, so I thought i would see what other recommendations people had.


Brian

bri...@aracnet.com

unread,
Jul 26, 2016, 12:35:49 AM7/26/16
to Oleg Grenrus, haskell-cafe
On Mon, 25 Jul 2016 22:30:24 +0300
Oleg Grenrus <oleg.g...@iki.fi> wrote:

> Seems that `vector-random-0.2` is incompatible with new fusion implementation of `vector-0.11`
> Also due “recent” GHC being more strict about pragmas, build fails for all GHC >=7.2
>
> Data/Vector/Random/Mersenne.hs:85:5:
> The INLINE pragma for default method `random' lacks an accompanying binding
>
> I edited bounds on Hackage to disallow invalid build-plans.
>

Do you think it's fixable by going through and updating pragmas and such, or does it require a more involved rewrite ?

Theodore Lief Gannon

unread,
Jul 26, 2016, 12:52:05 AM7/26/16
to bri...@aracnet.com, haskel...@haskell.org

It's been well over a year since I was looking at RNGs and I'm not sure I trust my instincts from that far back, but my pick at the time was pcg-random: https://hackage.haskell.org/package/pcg-random

bri...@aracnet.com

unread,
Jul 26, 2016, 1:21:17 AM7/26/16
to Theodore Lief Gannon, haskel...@haskell.org
On Mon, 25 Jul 2016 21:51:57 -0700
Theodore Lief Gannon <tan...@gmail.com> wrote:

> It's been well over a year since I was looking at RNGs and I'm not sure I
> trust my instincts from that far back, but my pick at the time was
> pcg-random: https://hackage.haskell.org/package/pcg-random
>

Thanks. I hadn't seen that one.

Dominic Steinitz

unread,
Jul 26, 2016, 5:08:52 AM7/26/16
to haskel...@haskell.org
If you want distributions in distinction to just a random number
generator, I recommend random-fu. You can plug in at least MT and MWC
as the random number generators and you get pdfs and cdfs as well.
Let me know if you need anything adding to it. I am also keen to
improve its documentation. I made a small start here:
https://hackage.haskell.org/package/random-fu-0.2.7.0/docs/Data-Random-
Distribution-Binomial.html but time as always is the enemy. Feel free
to contribute.

Dominic.

bri...@aracnet.com

unread,
Jul 27, 2016, 12:35:45 AM7/27/16
to Dominic Steinitz, haskel...@haskell.org
On Tue, 26 Jul 2016 09:08:30 +0000 (UTC)
Dominic Steinitz <dom...@steinitz.org> wrote:

> If you want distributions in distinction to just a random number
> generator, I recommend random-fu. You can plug in at least MT and MWC
> as the random number generators and you get pdfs and cdfs as well.
> Let me know if you need anything adding to it. I am also keen to
> improve its documentation. I made a small start here:
> https://hackage.haskell.org/package/random-fu-0.2.7.0/docs/Data-Random-
> Distribution-Binomial.html but time as always is the enemy. Feel free
> to contribute.
>

I'll definitely give it a try.

Thanks.


Brian

Reply all
Reply to author
Forward
0 new messages