37 lines
805 B
C++
37 lines
805 B
C++
/*
|
||
* © Copyright 2014 – Urheberrechtshinweis
|
||
* Alle Rechte vorbehalten / All Rights Reserved
|
||
*
|
||
* Programmcode ist urheberrechtlich geschuetzt.
|
||
* Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner.
|
||
* Keine Verwendung ohne explizite Genehmigung.
|
||
* (vgl. § 106 ff UrhG / § 97 UrhG)
|
||
*/
|
||
|
||
#ifndef K_MATH_RND_UNIQUE_H
|
||
#define K_MATH_RND_UNIQUE_H
|
||
|
||
namespace Random {
|
||
|
||
/**
|
||
* provides some common functions
|
||
* for handling uniquely distributed random numbers
|
||
*/
|
||
class Unique {
|
||
|
||
public:
|
||
|
||
/** get uniquely distributed random number between min and max */
|
||
static double getBetween(double min, double max) {
|
||
double rnd = (double) rand() / (double) RAND_MAX;
|
||
rnd *= (max-min);
|
||
rnd += min;
|
||
return rnd;
|
||
}
|
||
|
||
};
|
||
|
||
}
|
||
|
||
#endif // K_MATH_RND_UNIQUE_H
|