Skip to content

Commit

Permalink
removed defunct tinymt32.cpp. Fixed an issue where Enum was outdated.…
Browse files Browse the repository at this point in the history
… changed some logic in RNG.
  • Loading branch information
piyushk committed Oct 14, 2014
1 parent 2434a6e commit 1f0abb1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 157 deletions.
2 changes: 1 addition & 1 deletion bwi_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ add_library(${PROJECT_NAME}_json
)

add_library(${PROJECT_NAME}
src/common/tinymt32.cpp
src/common/Enum.cpp
src/common/Util.cpp
)

Expand Down
2 changes: 1 addition & 1 deletion bwi_tools/include/bwi_tools/common/Enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <string>
#include <vector>
#include <string.h>
#include <bwi_rl/common/Params.h>
#include <bwi_tools/common/Params.h>

/**
* @class EnumName
Expand Down
20 changes: 9 additions & 11 deletions bwi_tools/include/bwi_tools/common/RNG.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,27 @@
class RNG : public boost::mt19937 {

public:
RNG (int seed) : boost::mt19937(seed) {}
RNG (unsigned int seed) : boost::mt19937(seed) {}

inline float randomFloat() {
boost::uniform_real<float> dist;
boost::variate_generator<boost::mt19937&, boost::uniform_real<float> > gen(*this, dist);
return gen();
}

inline unsigned int randomUInt() {
boost::uniform_int<unsigned int> dist(0, std::numeric_limits<unsigned int>::max());
boost::variate_generator<boost::mt19937&, boost::uniform_int<unsigned int> > gen(*this, dist);
inline int randomInt(int min, int max) {
boost::uniform_int<int> dist(min, max);
boost::variate_generator<boost::mt19937&, boost::uniform_int<int> > gen(*this, dist);
return gen();
}

inline unsigned int randomInt(unsigned int max) {
boost::uniform_int<unsigned int> dist(0, max - 1);
boost::variate_generator<boost::mt19937&, boost::uniform_int<unsigned int> > gen(*this, dist);
return gen();
inline int randomInt(int max = std::numeric_limits<int>::max()) {
return randomInt(0, max);
}

inline int randomInt(int min, int max) {
boost::uniform_int<int> dist(min, max - 1);
boost::variate_generator<boost::mt19937&, boost::uniform_int<int> > gen(*this, dist);
inline int randomUInt(unsigned int max = std::numeric_limits<unsigned int>::max()) {
boost::uniform_int<unsigned int> dist(0, max);
boost::variate_generator<boost::mt19937&, boost::uniform_int<unsigned int> > gen(*this, dist);
return gen();
}

Expand Down
2 changes: 1 addition & 1 deletion bwi_tools/src/common/Enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Thomas Röfer
*/

#include <bwi_rl/common/Enum.h>
#include <bwi_tools/common/Enum.h>
#include <cassert>

std::string EnumName::trim(const std::string& s)
Expand Down
143 changes: 0 additions & 143 deletions bwi_tools/src/common/tinymt32.cpp

This file was deleted.

0 comments on commit 1f0abb1

Please sign in to comment.