[riot-devel] To global seed or not to global seed

Thomas C. Schmidt t.schmidt at haw-hamburg.de
Wed Mar 8 10:51:09 CET 2017


Hi Oleg, Ludwig,

On 08.03.2017 10:30, Oleg Hahm wrote:
> Hi Ludwig!
>
> On Wed, Mar 08, 2017 at 10:28:13AM +0100, Ludwig Knüpfer wrote:
>> Am 8. März 2017 10:21:15 MEZ schrieb Oleg Hahm <oliver.hahm at inria.fr>:
>>> Is testing and simulation the only use case you can imagine? I'm somewhat
>>> reluctant to add code just for non-production purposes.
>>
>> Since we outspokenly target researchers with RIOT this is a production feature.
>>
>> However we might want to move this feature into a dedicated implementation
>> of the same interface.
>
> Thanks, that was more or less what I meant.

I'm not sure whether we 'over-complicate' the issue.

There are good PRNGs with state space of one (or very few) int, call it 
seed. So if this function is called as 'rand(seed)', rand can be 
stateless ... and seed is allocated memory of the application. Seeds 
could be initially generated by 'random_init(seed)'.

At the same time, one can overload with a stateful 'rand()' which is 
auto-initialized and convenient ... and for those who don't care for 
more control. IMO, this would not need a 'random_init()' user call.

Cheers,
  Thomas


Btw: David Jones (UCL Bioinformatics) writes "Rule #1: Do not use system 
generators. ... Almost all of these generators are badly flawed. Even 
when they are not, there is no guarantee that they were not flawed in 
earlier releases of the library."


-- 

Prof. Dr. Thomas C. Schmidt
° Hamburg University of Applied Sciences                   Berliner Tor 7 °
° Dept. Informatik, Internet Technologies Group    20099 Hamburg, Germany °
° http://www.haw-hamburg.de/inet                   Fon: +49-40-42875-8452 °
° http://www.informatik.haw-hamburg.de/~schmidt    Fax: +49-40-42875-8409 °


More information about the devel mailing list