Skip to content

JSF RNG in listing 0066 is not using the recommended values for the 64-bit variant #68

@aameen951

Description

@aameen951

Hi,

This is not a really an issue, feel free to close this.

I was looking into the JSF RNG and I thought it is worth mentioning that the implementation in listing 0066 is using 64-bit integers in the generation function RandomU64 whereas the original post is using 32-bit integers. There is a section in the original post for the 64-bit variant where they recommend using a three-rotate version with the values (7,13,37) as follows:

u8 ranval( ranctx *x ) {
    u8 e = x->a - rot(x->b, 7);
    x->a = x->b ^ rot(x->c, 13);
    x->b = x->c + rot(x->d, 37);
    x->c = x->d + e;
    x->d = e + x->a;
    return x->d;
}

Listing 0066:

u64 E = A - RotateLeft(B, 27);
A = (B ^ RotateLeft(C, 17));
B = (C + D);
C = (D + E);
D = (E + A);

This is probably irrelevant and very insignificant but I thought I would mention it for the record and for the sake of completion

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions