Skip to content

<random>: Cannot save/restore a ranlux48 object in a stream #437

Description

Describe the bug
It appears that the textual representation of ranlux48 is incorrect

Command-line test case
STL version (git commit or Visual Studio version): Visual Studio 2019 version 16.4 (but goes back effectively forever)

C:\Users\bion\Desktop>type test.cpp
#include <iostream>
#include <random>
#include <sstream>

template <typename RND> void check(const char *name) {
  RND g1, g2;
  std::cout << std::boolalpha << name << ": " << (g1 == g2);
  std::stringstream s;
  s << g1;
  s >> g1;
  std::cout << " " << (g1 == g2) << std::endl;
}

int main() {
  check<std::ranlux48>("ranlux48");
  check<std::ranlux24>("ranlux24");
  check<std::mt19937>("mt19937");
}

C:\Users\bion\Desktop>cl /EHsc /W4 /WX /std:c++latest /nologo .\test.cpp
test.cpp

C:\Users\bion\Desktop>.\test.exe
ranlux48: true false
ranlux24: true true
mt19937: true true

C:\Users\bion\Desktop>

Expected behavior
ranlux48: true true
ranlux24: true true
mt19937: true true

This issue is a dual of Microsoft-internal VSO-104809 and DevCom-249085

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions