[riot-notifications] [RIOT] add mersene twister (#168)

Oleg Hahm notifications at github.com
Thu Aug 22 15:51:14 CEST 2013


> +        i++;
> +        if (i >= N) {
> +            mt[0] = mt[N - 1];
> +            i = 1;
> +        }
> +    }
> +
> +    mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
> +}
> +
> +/**
> + * generates a random number on [0,0xffffffff]-interval
> + */
> +uint32_t genrand_int32(void)
> +{
> +    uint32_t y;

Ok, I see, it's a matter of personal taste, but ad 1.)
```
1. often you have to scroll up a page or two to find the declaration ("Was `i` signed or unsigned, again?").
```
in the case of a scope spanning more than one page the code has severe problems anyway.

I'm against adding a rule regarding the variable placement to the coding conventions.

---
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/168/files#r5924196
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20130822/581dc25f/attachment.html>


More information about the notifications mailing list