Skip to content

rand! with RNG and Complex{Int128} isn't random #721

@nhz2

Description

@nhz2

Only the least significant 64 bits of each Int128 are random. The 64 most significant bits are all zero.

MWE:

julia> using GPUArrays, JLArrays, Random

julia> rng = GPUArrays.RNG{JLArray}(42)
GPUArrays.RNG{JLArray}(0x000000000000002a, 0x00000000)

julia> A = JLArray{Complex{Int128}}(undef, 1000);

julia> Random.rand!(rng, A);

julia> count(x -> real(x) < 0, A)
0

julia> count(x -> real(x) < 0, rand(Complex{Int128}, 1000))
496

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions