Re: a more useful srand (was Re: r30369 - docs/Perl6/Spec/S32-setting-library)

2010-04-15 Thread François Perrad
2010/4/13 Aaron Sherman : > On Mon, Apr 12, 2010 at 1:55 PM, Larry Wall wrote: > >> On Mon, Apr 12, 2010 at 07:24:37PM +0200, Moritz Lenz wrote: >> : > 1. do all implementations of Perl6 generate the same sequence, given >> the >> : > same initial seed. >> : >> : I don't think they should. If you

Re: a more useful srand (was Re: r30369 - docs/Perl6/Spec/S32-setting-library)

2010-04-14 Thread Larry Wall
On Tue, Apr 13, 2010 at 01:29:59AM -0400, Aaron Sherman wrote: : PRNGs are often misrepresented as frivolous, but as I'm sure you know from : your work at JPL, high quality random sequences are much-prized, and any : language that starts off with some poor assumptions will ultimately pay for : it.

Re: a more useful srand (was Re: r30369 - docs/Perl6/Spec/S32-setting-library)

2010-04-12 Thread Aaron Sherman
On Mon, Apr 12, 2010 at 1:55 PM, Larry Wall wrote: > On Mon, Apr 12, 2010 at 07:24:37PM +0200, Moritz Lenz wrote: > : > 1. do all implementations of Perl6 generate the same sequence, given > the > : > same initial seed. > : > : I don't think they should. If you want that, use confuse a RNG with a

Re: a more useful srand (was Re: r30369 - docs/Perl6/Spec/S32-setting-library)

2010-04-12 Thread Larry Wall
On Mon, Apr 12, 2010 at 07:24:37PM +0200, Moritz Lenz wrote: : Dave Whipp wrote: : > masak wrote: : >> Modified: : >>docs/Perl6/Spec/S32-setting-library/Numeric.pod : >> Log: : >> [S32/Numeric] removed method form of srand : >> : >> Overwhelming consent on #perl6 about this. : >> : >> - multi

Re: a more useful srand (was Re: r30369 - docs/Perl6/Spec/S32-setting-library)

2010-04-12 Thread Dave Whipp
Moritz Lenz wrote: 1) A RNG class (don't really care what the name is, for now) 2) An instance of that in $*RAND (which you can temp()) 3) rand() and srand() act on $*RAND 4) It should be easy to create instances of the RNG to use in your own class. The sounds reasonable. The one thing I'd add

Re: r30369 - docs/Perl6/Spec/S32-setting-library

2010-04-12 Thread yary
Tangentially, I'm a little surprised there isn't a random stream factory in the core. They're useful for reproducible testing. With a global random number generator, even if you seed it, another module can call "rand" and alter the sequence you get from your "rand" calls. I think something like "sr

Re: a more useful srand (was Re: r30369 - docs/Perl6/Spec/S32-setting-library)

2010-04-12 Thread Moritz Lenz
Dave Whipp wrote: > masak wrote: >> Modified: >>docs/Perl6/Spec/S32-setting-library/Numeric.pod >> Log: >> [S32/Numeric] removed method form of srand >> >> Overwhelming consent on #perl6 about this. >> >> - multi method srand ( Real $seed: ) >> multi srand ( Real $seed = default_seed_algori

Re: a more useful srand (was Re: r30369 - docs/Perl6/Spec/S32-setting-library)

2010-04-12 Thread Mark J. Reed
On Mon, Apr 12, 2010 at 12:59 PM, Dave Whipp wrote: > 2a. If I spawn two threads (implicitly or explicitly), how do their RNGs > interact? I.e. are C and C thread-safe? > I've noticed that this is a potentially-surprising source of lock contention in Java - all threads share common RNG state, ac

a more useful srand (was Re: r30369 - docs/Perl6/Spec/S32-setting-library)

2010-04-12 Thread Dave Whipp
masak wrote: Modified: docs/Perl6/Spec/S32-setting-library/Numeric.pod Log: [S32/Numeric] removed method form of srand Overwhelming consent on #perl6 about this. - multi method srand ( Real $seed: ) multi srand ( Real $seed = default_seed_algorithm()) Seed the generator C uses. C<$seed>