include/xot/util.h in xot-0.1.7 vs include/xot/util.h in xot-0.1.8

- old
+ new

@@ -3,18 +3,41 @@ #ifndef __XOT_UTIL_H__ #define __XOT_UTIL_H__ #include <stdint.h> +#include <math.h> +#include <xot/defs.h> +#include <xot/time.h> namespace Xot { int bit2byte (int bits); int byte2bit (int bytes); + + + void seed (uint value = (uint) (time() * 1000)); + + double random (double max_ = 1); + + double random (double min_, double max_); + + + template <typename T> + inline T deg2rad (T degree) + { + return degree / (T) 180 * M_PI; + } + + template <typename T> + inline T rad2deg (T radian) + { + return radian / M_PI * (T) 180; + } template <typename T> inline T clip (T minval, T maxval, T value) {