- Timestamp:
- Mar 10, 2020, 2:53:34 AM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 22217d4
- Parents:
- 44f23af
- git-author:
- Dmitry Portnoy <dmp1488@…> (03/10/20 00:43:57)
- git-committer:
- Dmitry Portnoy <dmp1488@…> (03/10/20 02:53:34)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
utils.cpp
r44f23af r0807aeb 1 1 #include "utils.hpp" 2 2 3 #include <ctime> 3 4 #include <iostream> 4 5 6 #include "compiler.hpp" 7 8 #ifdef WINDOWS 9 #include <process.h> 10 #else 11 #include <unistd.h> 12 #endif 13 14 // TODO: Use a more modern method of generating random numbers 15 16 void seedRandomNums() { 17 #ifdef WINDOWS 18 srand(_getpid() ^ time(nullptr)); 19 #else 20 srand(getpid() ^ time(nullptr)); 21 #endif 22 } 23 5 24 float getRandomNum(float low, float high) { 6 return low + ((float)rand() / RAND_MAX) * (high -low);25 return low + ((float)rand() / RAND_MAX) * (high - low); 7 26 } 8 27
Note:
See TracChangeset
for help on using the changeset viewer.