News for hackers. Stuff that matters.
Re:14 Character Random Number Generator in C by eutectic on Wednesday February 08, 2017 @11:46AM (#13599685)
A 15 character 64 to 32-bit generator I devised which passes dieharder:

    (x+=x*x+9)>>32;
Re:14 Character Random Number Generator in C by joegosse on Wednesday February 08, 2017 @12:32PM (#13600164)
Is dieharder considered as the industry standard tool for testing randomness? Is it commonly used by experts?

https://www.phy.duke.edu/~rgb/General/dieharder.php

Re:14 Character Random Number Generator in C by eutectic on Wednesday February 08, 2017 @12:37PM (#13600216)
Dieharder works OK, and you can easily install it on Ubuntu as a command-line tool. PractRand and TestU01 are more stringent and give you more knobs to play with.
Re:14 Character Random Number Generator in C by Someone on Wednesday February 08, 2017 @03:13PM (#13601591)
That can be made shorter:

  x+=x*x+9;
Are you sure you don't mean

  x+=((x*x+9)>>32);
(and does that need the outer parentheses?) I doubt the first passes dieharder, as (if my C isn't too rusty) it alternates between odd and even numbers.
Re:14 Character Random Number Generator in C by eutectic on Wednesday February 08, 2017 @04:06PM (#13602103)
I mean you assign the value of the expression to your result.

e.g:

    uint64_t x = 0;
    ...
    uint32_t y = (x+=x*x+9)>>32;