Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-16 Thread Jeroen Demeyer
On 2015-11-13 22:53, Nils Bruin wrote: You might want to use a better source, because the pid will not have much entropy. It has sufficient entropy to be different in every parallel process. So I think it is a good solution. Jeroen. -- You received this message because you are subscribed to

Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-15 Thread mmarco
There are python modules that provide cryptografically secure RNG's.: sage: from Crypto.Random.random import randint sage: @parallel : def f(a): : return a+randint(int(0),int(2^64-1))/2.0^64 : sage: [ v for _,v in f(range(10))] [0.448332695597944, 1.1694151387

Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-14 Thread Nils Bruin
On Saturday, November 14, 2015 at 2:52:15 AM UTC-8, Thierry (sage-googlesucks@xxx) wrote: > > Why not simply get a fresh seed ? > > sage: @parallel > : def f(a): > : sage.misc.randstate.set_random_seed() > : return a+random() > If os.urandom works then that's a good option

Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-14 Thread Thierry
Hi, On Fri, Nov 13, 2015 at 01:53:25PM -0800, Nils Bruin wrote: > On Friday, November 13, 2015 at 1:18:07 PM UTC-8, Dima Pasechnik wrote: > > > > how one would then run a randomised algorithm in parallel? (e.g. testing > > property with random input) > > In such a case one certainly need somethin

Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-13 Thread Sébastien Labbé
> Feature - the calls all happen at once starting with the same state of >> sage including the random state. >> >> > > how one would then run a randomised algorithm in parallel? (e.g. testing > property with random input) > In such a case one certainly need something orthogonal to this. > Ca

Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-13 Thread Nils Bruin
On Friday, November 13, 2015 at 1:53:25 PM UTC-8, Nils Bruin wrote: > > I would think this is the kind of thing that is worth documenting > somewhere. > Particularly because the behaviour depends on the underlying parallellization mechanism: @parallel(p_iter="multiprocessing") def f(a): ret

Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-13 Thread Nils Bruin
On Friday, November 13, 2015 at 1:18:07 PM UTC-8, Dima Pasechnik wrote: > > how one would then run a randomised algorithm in parallel? (e.g. testing > property with random input) > In such a case one certainly need something orthogonal to this. > Something like this? @parallel > def f(a): >

Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-13 Thread Dima Pasechnik
On Friday, 13 November 2015 18:02:14 UTC, William wrote: > > > > On Friday, November 13, 2015, Sébastien Labbé > wrote: > >> Is this a feature or a bug? >> >> > Feature - the calls all happen at once starting with the same state of > sage including the random state. > how one would then run a

Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-13 Thread William Stein
On Friday, November 13, 2015, Sébastien Labbé wrote: > Is this a feature or a bug? > > Feature - the calls all happen at once starting with the same state of sage including the random state. > > sage: @parallel > : def f(a): > : return a+random() > : > sage: [v for _,v in f(ran