diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/random.hxx | 21 | ||||
-rw-r--r-- | include/drawinglayer/tools/converters.hxx | 2 |
2 files changed, 19 insertions, 4 deletions
diff --git a/include/comphelper/random.hxx b/include/comphelper/random.hxx index 6b5d6eb86377..e7051a860403 100644 --- a/include/comphelper/random.hxx +++ b/include/comphelper/random.hxx @@ -18,11 +18,24 @@ namespace comphelper namespace rng { -/// set initial seed (equivalent of libc srand()) -COMPHELPER_DLLPUBLIC void seed(int i); +/// reset initial seed, typically you don't call this as the initial seed is taken from the +// time on the first use of the distribution functions +COMPHELPER_DLLPUBLIC void reseed(int i); -/// uniform distribution in [0,1) -COMPHELPER_DLLPUBLIC double uniform(); +// note that uniform_int_distribution is inclusive of b, i.e. [a,b] while +// uniform_real_distribution is exclusive of b, i.e. [a,b), [std/boost]::nextafter may be your friend there + +/// uniform distribution in [a,b) +COMPHELPER_DLLPUBLIC double uniform_real_distribution(double a = 0.0, double b = 1.0); + +/// uniform distribution in [a,b] +COMPHELPER_DLLPUBLIC int uniform_int_distribution(int a, int b); + +/// uniform distribution in [a,b] +COMPHELPER_DLLPUBLIC unsigned int uniform_int_distribution(unsigned int a, unsigned int b); + +/// uniform distribution in [a,b] +COMPHELPER_DLLPUBLIC size_t uniform_int_distribution(size_t a, size_t b); } // namespace diff --git a/include/drawinglayer/tools/converters.hxx b/include/drawinglayer/tools/converters.hxx index 957973f8bda1..c004e25a7a3c 100644 --- a/include/drawinglayer/tools/converters.hxx +++ b/include/drawinglayer/tools/converters.hxx @@ -37,6 +37,8 @@ namespace drawinglayer sal_uInt32 nDiscreteHeight, sal_uInt32 nMaxQuadratPixels); + double DRAWINGLAYER_DLLPUBLIC getRandomColorRange(); + } // end of namespace tools } // end of namespace drawinglayer |