X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fipdf.h;h=e150088ce90058837e877f638f5ad280bab35a4a;hp=0264d96f550c719846cea1471bb9d02b6d3c1105;hb=428f1eb86a616d95dbb72ff08a3d09771d5c47e6;hpb=245ccc8576d4bd29ab04d506ddb0c44b04a67e39 diff --git a/src/ipdf.h b/src/ipdf.h index 0264d96..e150088 100644 --- a/src/ipdf.h +++ b/src/ipdf.h @@ -8,12 +8,17 @@ namespace IPDF typedef float Real; inline float RealToFloat(Real r) {return r;} + inline Real Random(Real max=1, Real min=0) + { + return min + (max-min) * ((Real)(rand() % (int)1e6) / 1e6); + } typedef unsigned ObjectID; struct Rect { Real x; Real y; Real w; Real h; + Rect() = default; // Needed so we can fread/fwrite this struct Rect(Real _x, Real _y, Real _w, Real _h) : x(_x), y(_y), w(_w), h(_h) {} std::string Str() {