random.cpp
Go to the documentation of this file.
00001 
00023 #include "micros_swarm/random.h"
00024 
00025 namespace micros_swarm{
00026 
00027     int random_int(int min, int max)
00028     {
00029         return (rand() % (max - min + 1)) + min;
00030     }
00031 
00032     float random_float(float min, float max)
00033     {
00034         float tmp_rand = rand() / float(RAND_MAX);
00035         return min + max * tmp_rand;
00036     }
00037 
00038     /*int test(void)
00039     {
00040         for (int i = 0; i < 15; i++) {
00041             std::cout<<random_int(0, 15, time(NULL)) << " ";
00042         }
00043         std::cout<<std::endl;
00044         return 0;
00045     }*/
00046 };


micros_swarm
Author(s):
autogenerated on Thu Jun 6 2019 18:52:14