Changeset 843 for cpp/common


Ignore:
Timestamp:
12/08/18 05:35:57 (5 years ago)
Author:
Maciej Komosinski
Message:

Our random number generator class becomes compatible with std::UniformRandomBitGenerator?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/random.h

    r324 r843  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
     4
     5#ifdef _MSC_VER
     6 #define NOMINMAX //we don't want Windows headers (minwindef.h) to define min() and max() as macros
     7 #undef min //for some reason, NOMINMAX did not work so we have to #undef anyway
     8 #undef max
     9#endif
    410
    511#include "nonstd.h" //LONGLONG
     
    108114        }
    109115
     116        //UniformRandomBitGenerator
     117        typedef unsigned int result_type;
     118        static unsigned int min() {return 0;}
     119        static unsigned int max() {return MAXVALUE;}
     120        inline unsigned int operator()() {return getUint32();}
     121
    110122        inline double getDouble() // [0,1)
    111123        {
Note: See TracChangeset for help on using the changeset viewer.