Skip to content

boost::random::splitmix64::discard: O(n) -> O(1) #141

@bddap

Description

@bddap

boost::random::splitmix64::discard is potentially/probably pokey:

    /** Advances the state of the generator by @c z. */
    inline void discard(std::uint64_t z) noexcept
    {
        for (std::uint64_t i {}; i < z; ++i)
        {
            next();
        }
    }

perhaps pick this more performant procedure

    /** Advances the state of the generator by @c z. */
    inline void discard(std::uint64_t z) noexcept
    {
        _state += z * UINT64_C(0x9E3779B97F4A7C15);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions