aboutsummaryrefslogtreecommitdiff
path: root/src/utility.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utility.cpp')
-rw-r--r--src/utility.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/utility.cpp b/src/utility.cpp
index 7a43f53d2..6ce67cb3f 100644
--- a/src/utility.cpp
+++ b/src/utility.cpp
@@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gettime.h"
#include "sha1.h"
#include "base64.h"
+#include "log.h"
TimeTaker::TimeTaker(const char *name, u32 *result)
{
@@ -47,7 +48,7 @@ u32 TimeTaker::stop(bool quiet)
else
{
if(quiet == false)
- std::cout<<m_name<<" took "<<dtime<<"ms"<<std::endl;
+ infostream<<m_name<<" took "<<dtime<<"ms"<<std::endl;
}
m_running = false;
return dtime;
@@ -156,6 +157,21 @@ void mysrand(unsigned seed)
next = seed;
}
+int myrand_range(int min, int max)
+{
+ if(max-min > MYRAND_MAX)
+ {
+ errorstream<<"WARNING: myrand_range: max-min > MYRAND_MAX"<<std::endl;
+ assert(0);
+ }
+ if(min > max)
+ {
+ assert(0);
+ return max;
+ }
+ return (myrand()%(max-min+1))+min;
+}
+
#ifndef SERVER
// Sets the color of all vertices in the mesh
void setMeshVerticesColor(scene::IMesh* mesh, video::SColor& color)