+
+ // Ensure we initialize only once. As it's inlined, this static variable will exist in the code-block using it, thus,
+ // will be created and then initialized again when another code-block uses this.
+ static bool initialized( false );
+ if( !initialized )
+ {
+ uint32_t seed = static_cast<uint32_t>( time( NULL ) );
+ srand( seed );
+ initialized = true;
+ }
+
+ int32_t randValue = rand();
+ return static_cast<float>(randValue & 0xfff) * (1.0f/4095.0f) * (max-min) + min;