[Bug] Random number generator causing static assert #48

Closed
opened 2022-08-25 11:06:45 -04:00 by ArtemisX64 · 1 comment
ArtemisX64 commented 2022-08-25 11:06:45 -04:00 (Migrated from github.com)

Cemu
Version 2.0(Latest Upstream)
Test Platform: Linux

Issue

Discover why random number generator is causing static assert particularly in cemu

Other Notes

It works outside of cemu repository using clang14 and libstdc++

Example of function having issue

std::string GenerateRandomString(size_t length, std::string_view characters)
{
    assert(!characters.empty());
    std::stringstream result;

    std::random_device rd;
    std::mt19937 gen(rd());
    std::uniform_int_distribution<decltype(characters.size())> index_dist(0, characters.size() - 1);
    for (uint32_t i = 0; i < length; ++i)
    {
        result << characters[index_dist(gen)]; //Issue occurs with this function[index_dist(gen)] during compilation
    }

    return result.str();
}
Cemu Version 2.0(Latest Upstream) Test Platform: Linux ## Issue Discover why random number generator is causing static assert particularly in cemu ## Other Notes It works outside of cemu repository using clang14 and libstdc++ ### Example of function having issue ```cc std::string GenerateRandomString(size_t length, std::string_view characters) { assert(!characters.empty()); std::stringstream result; std::random_device rd; std::mt19937 gen(rd()); std::uniform_int_distribution<decltype(characters.size())> index_dist(0, characters.size() - 1); for (uint32_t i = 0; i < length; ++i) { result << characters[index_dist(gen)]; //Issue occurs with this function[index_dist(gen)] during compilation } return result.str(); } ```
Exzap commented 2022-08-26 08:32:13 -04:00 (Migrated from github.com)

Reopening this because the actual cause has yet to be found

Reopening this because the actual cause has yet to be found
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: cemu-project_Mirror/Cemu-2024-03-05#48
No description provided.