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

René Kijewski notifications at github.com
Wed Aug 21 23:18:40 CEST 2013


> + * initialize by an array with array-length
> + * init_key is the array for initializing keys
> + * key_length is its length
> + * slight change for C++, 2004/2/26
> + */
> +void init_by_array(uint32_t init_key[], int key_length)
> +{
> +    int i, j, k;
> +    init_genrand(19650218UL);
> +    i = 1;
> +    j = 0;
> +    k = (N > key_length ? N : key_length);
> +    for (; k; k--) {
> +        mt[i] = (mt[i] ^ ((mt[i - 1] ^ (mt[i - 1] >> 30)) * 1664525UL))
> +                + init_key[j] + j; /* non linear */
> +        mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */

Same as line 70.

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


More information about the notifications mailing list