From: Vitaly V. B. <vit...@us...> - 2004-09-30 05:38:36
|
On Wed, 29 Sep 2004 22:05:49 +0200 Dennis Smit <sy...@yo...> wrote: > On Wed, 2004-09-29 at 21:36 +0100, salsaman wrote: > > Actually, what would be *really* nice is if a host application could set > > a random seed as in: > > > > visual_actor_set_seed(uint32_t seed); > > > > visual_actor_set_seed(123456); // set seed to 123456 > > > > visual_actor_set_seed(0); // let libvisual choose a (pseudo random) seed > > Yes that would be kinda nice, but it's difficult to do because all the > plugins need many changes to support this correctly. And the plugins > we interface through an API would just not support this. So it's kinda > hard. Hm, I don't think it's hard. :) just few lines of code. Fast way to do this is to define these globals: void visual_set_seed(uint32_t seed); uint32_t visual_get_seed(); uint32_t visual_random(); With no multi-threading everything should be absolutely reproducible ;) Next, this plugin-specific api: void visual_plugin_set_seed(VisPluginInfo*, uint32_t seed); uint32_t visual_plugin_get_seed(VisPluginInfo*); void visual_plugin_random(VisPluginInfo*); state of the random number generation algo will be strored in VisPluginInfo. One thing: we need to borrow nice pseudo-random numbger gen algo. OK? -- Vitaly GPG Key ID: F95A23B9 |