Search

std::mt19937_64::seed() takes a 32-bit (unsigned long) argument by tylerstreeter

Closed
as Deferred Help for as Deferred

1
0
Sign in
to vote
Type: Bug
ID: 779231
Opened: 2/14/2013 9:15:45 AM
Access Restriction: Public
1
Workaround(s)
0
User(s) can reproduce this bug
std::mt19937_64::seed() should take a 64-bit seed (unsigned long long int), but instead it takes a 32-bit seed (unsigned long).
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

Visual Studio 2012

Steps to reproduce

#include <random>
int main()
{
    std::mt19937_64 gen;
    unsigned long long int x = 5;
    gen.seed(x);
    return 0;
}

Product Language

English

Operating System

Windows 7 SP1

Operating System Language

English

Actual results

warning C4244: 'argument' : conversion from 'unsigned __int64' to 'unsigned long', possible loss of data

Expected results

No warnings.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 3/26/2013 at 12:36 AM
Hi,

Thanks for reporting this bug. I wanted to let you know what's happening with it. I'm still keeping track of it, but it's been resolved as "Deferred" because we may not have time to fix it in VC12. (Note: VC8 = VS 2005, VC9 = VS 2008, VC10 = VS 2010, VC11 = VS 2012.)

Note: Connect doesn't notify me about comments. If you have any further questions, please E-mail me.

Stephan T. Lavavej
Senior Developer - Visual C++ Libraries
stl@microsoft.com
Posted by Microsoft on 2/14/2013 at 7:56 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 2/14/2013 at 9:54 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by tylerstreeter on 2/14/2013 at 9:21 AM
// Providing a 64-bit seed to the constructor seems to work. This is a workaround
// for some cases (if the seed value is known when the generator is constructed),
// but not if seed() needs to be called after construction.
unsigned long long int x = 5;
std::mt19937_64 gen(x);