diff --git a/Makefile.am b/Makefile.am index b4c8576..87fb83f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,8 +4,8 @@ libcwSRC = libcwHDR += src/libcw/cwCommon.h src/libcw/cwCommonImpl.h src/libcw/cwMem.h src/libcw/cwLog.h src/libcw/cwUtility.h libcwSRC += src/libcw/cwCommonImpl.cpp src/libcw/cwMem.cpp src/libcw/cwLog.cpp src/libcw/cwUtility.cpp -libcwHDR += src/libcw/cwString.h src/libcw/cwVectOps.h src/libcw/cwMtx.h src/libcw/cwVariant.h -libcwSRC += src/libcw/cwString.cpp src/libcw/cwMtx.cpp src/libcw/cwVariant.cpp +libcwHDR += src/libcw/cwString.h src/libcw/cwMath.h src/libcw/cwVectOps.h src/libcw/cwMtx.h src/libcw/cwVariant.h +libcwSRC += src/libcw/cwString.cpp src/libcw/cwMath.cpp src/libcw/cwMtx.cpp src/libcw/cwVariant.cpp libcwHDR += src/libcw/cwFileSys.h src/libcw/cwText.h src/libcw/cwFile.h src/libcw/cwTime.h src/libcw/cwLex.h src/libcw/cwNumericConvert.h libcwSRC += src/libcw/cwFileSys.cpp src/libcw/cwText.cpp src/libcw/cwFile.cpp src/libcw/cwTime.cpp src/libcw/cwLex.cpp diff --git a/cwMath.cpp b/cwMath.cpp new file mode 100644 index 0000000..0ddfae8 --- /dev/null +++ b/cwMath.cpp @@ -0,0 +1,9 @@ +#include "cwCommon.h" +#include "cwLog.h" +#include "cwCommonImpl.h" +#include "cwMath.h" + +unsigned cw::math::randUInt( unsigned minVal, unsigned maxVal ) +{ + return std::max(minVal,std::min(maxVal,minVal + (unsigned)round(((maxVal - minVal) * rand())/RAND_MAX))); +} diff --git a/cwMath.h b/cwMath.h new file mode 100644 index 0000000..de9220a --- /dev/null +++ b/cwMath.h @@ -0,0 +1,14 @@ +#ifndef cwMath_h +#define cwMath_h + +namespace cw +{ + namespace math + { + unsigned randUInt(unsigned minVal, unsigned maxVal ); + + } +} + + +#endif