If your PRNG is consuming 40% of your CPU time, your playouts are too light.

Anyway, it's very easy to make a fast PRNG these days. The first thing that
comes to mind is a 64-bit linear congruential generator of which you use
the middle bits, or you can XOR the high 32 bits and the low 32 bits
together. LCGs have well-understood limitations that don't really matter
for a go program.

If you want higher-quality PRNs you need to use a large state, but you can
still make it be very fast. Still, try the LCG first. I would be surprised
if you find any degradation in strength of your engine compared to the
Mersenne twister.

Álvaro.



On Sun, Mar 29, 2015 at 12:05 PM, folkert <folk...@vanheusden.com> wrote:

> Ah!
> But how do you make sure the numbers are uniformly distributed?
>
> On Sun, Mar 29, 2015 at 05:58:56PM +0800, remco.bloe...@singularityu.org
> wrote:
> > I switched to SFMT [0].  But that was some years ago, there might be
> faster options now.
> >
> > I also generated it in megabyte batches and consume it from there,
> generating a new megabyte as needed.
> >
> > Lastly, I had some code to make sure I did not consume more bits of
> entropy than required.  Two uniform choices,  one bit.  Three choices:
> fractional bits.
> >
> > [0]
> >
> > http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/
> >
> > ??? Remco
> >
> > -----Original Message-----
> > From: folkert <folk...@vanheusden.com>
> > To: computer-go@computer-go.org
> > Sent: Sun, 29 Mar 2015 17:50
> > Subject: [Computer-go] fast + good RNG
> >
> > Hi,
> >
> > I measured that std::mt19937_64 (the mersenne twister from the standard
> > c++ libraries) uses about 40% cpu time during playouts.
> >
> > So I wonder: is there a faster prng while still generating good enough
> > random?
> >
> >
> > Folkert van Heusden
> >
> > --
> > Nagios user? Check out CoffeeSaint - the versatile Nagios status
> > viewer! http://www.vanheusden.com/java/CoffeeSaint/
> > ----------------------------------------------------------------------
> > Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
> > _______________________________________________
> > Computer-go mailing list
> > Computer-go@computer-go.org
> > http://computer-go.org/mailman/listinfo/computer-go
>
> > _______________________________________________
> > Computer-go mailing list
> > Computer-go@computer-go.org
> > http://computer-go.org/mailman/listinfo/computer-go
>
>
>
> Folkert van Heusden
>
> --
> MultiTail er et flexible tool for å kontrolere Logfiles og commandoer.
> Med filtrer, farger, sammenføringer, forskeliger ansikter etc.
> http://www.vanheusden.com/multitail/
> ----------------------------------------------------------------------
> Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
> _______________________________________________
> Computer-go mailing list
> Computer-go@computer-go.org
> http://computer-go.org/mailman/listinfo/computer-go
>
_______________________________________________
Computer-go mailing list
Computer-go@computer-go.org
http://computer-go.org/mailman/listinfo/computer-go

Reply via email to