From 9b93f6c68c08afd96d738c49a55201843cad72a6 Mon Sep 17 00:00:00 2001 From: Deskull Date: Mon, 3 Mar 2014 21:34:26 +0900 Subject: [PATCH] Add mt19337 engine to Dice class. --- Deeangband/Dice.cpp | 4 ++-- Deeangband/Dice.h | 2 ++ Deeangband/stdafx.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Deeangband/Dice.cpp b/Deeangband/Dice.cpp index b9a11e6..ad48618 100644 --- a/Deeangband/Dice.cpp +++ b/Deeangband/Dice.cpp @@ -45,12 +45,12 @@ int Dice::maxCast(int num, int side) int Dice::rand0(int max) { - return rand() % max; + return mt() % max; } int Dice::rand1(int max) { - return rand() % max + 1; + return mt() % max + 1; } bool Dice::saving(int diff) diff --git a/Deeangband/Dice.h b/Deeangband/Dice.h index 2a1a6bb..9c70260 100644 --- a/Deeangband/Dice.h +++ b/Deeangband/Dice.h @@ -16,6 +16,8 @@ class Dice { private: + static std::mt19937 mt; //!< ƒƒ‹ƒZƒ“ƒkƒcƒCƒXƒ^‚É‚æ‚闐”¶¬ƒGƒ“ƒWƒ“ + int num; //!< ƒ_ƒCƒX‚̐” int side; //!< ƒ_ƒCƒX‚̖ʐ” diff --git a/Deeangband/stdafx.h b/Deeangband/stdafx.h index 5a40475..30fb4cc 100644 --- a/Deeangband/stdafx.h +++ b/Deeangband/stdafx.h @@ -32,7 +32,8 @@ #include #include #include - +#include +#include #include #include #include -- 2.11.0