| 1 | /// @ref gtc_random |
| 2 | /// @file glm/gtc/random.hpp |
| 3 | /// |
| 4 | /// @see core (dependence) |
| 5 | /// @see gtx_random (extended) |
| 6 | /// |
| 7 | /// @defgroup gtc_random GLM_GTC_random |
| 8 | /// @ingroup gtc |
| 9 | /// |
| 10 | /// Include <glm/gtc/random.hpp> to use the features of this extension. |
| 11 | /// |
| 12 | /// Generate random number from various distribution methods. |
| 13 | |
| 14 | #pragma once |
| 15 | |
| 16 | // Dependency: |
| 17 | #include "../ext/scalar_int_sized.hpp" |
| 18 | #include "../ext/scalar_uint_sized.hpp" |
| 19 | #include "../detail/qualifier.hpp" |
| 20 | |
| 21 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) |
| 22 | # pragma message("GLM: GLM_GTC_random extension included") |
| 23 | #endif |
| 24 | |
| 25 | namespace glm |
| 26 | { |
| 27 | /// @addtogroup gtc_random |
| 28 | /// @{ |
| 29 | |
| 30 | /// Generate random numbers in the interval [Min, Max], according a linear distribution |
| 31 | /// |
| 32 | /// @param Min Minimum value included in the sampling |
| 33 | /// @param Max Maximum value included in the sampling |
| 34 | /// @tparam genType Value type. Currently supported: float or double scalars. |
| 35 | /// @see gtc_random |
| 36 | template<typename genType> |
| 37 | GLM_FUNC_DECL genType linearRand(genType Min, genType Max); |
| 38 | |
| 39 | /// Generate random numbers in the interval [Min, Max], according a linear distribution |
| 40 | /// |
| 41 | /// @param Min Minimum value included in the sampling |
| 42 | /// @param Max Maximum value included in the sampling |
| 43 | /// @tparam T Value type. Currently supported: float or double. |
| 44 | /// |
| 45 | /// @see gtc_random |
| 46 | template<length_t L, typename T, qualifier Q> |
| 47 | GLM_FUNC_DECL vec<L, T, Q> linearRand(vec<L, T, Q> const& Min, vec<L, T, Q> const& Max); |
| 48 | |
| 49 | /// Generate random numbers in the interval [Min, Max], according a gaussian distribution |
| 50 | /// |
| 51 | /// @see gtc_random |
| 52 | template<typename genType> |
| 53 | GLM_FUNC_DECL genType gaussRand(genType Mean, genType Deviation); |
| 54 | |
| 55 | /// Generate a random 2D vector which coordinates are regularly distributed on a circle of a given radius |
| 56 | /// |
| 57 | /// @see gtc_random |
| 58 | template<typename T> |
| 59 | GLM_FUNC_DECL vec<2, T, defaultp> circularRand(T Radius); |
| 60 | |
| 61 | /// Generate a random 3D vector which coordinates are regularly distributed on a sphere of a given radius |
| 62 | /// |
| 63 | /// @see gtc_random |
| 64 | template<typename T> |
| 65 | GLM_FUNC_DECL vec<3, T, defaultp> sphericalRand(T Radius); |
| 66 | |
| 67 | /// Generate a random 2D vector which coordinates are regularly distributed within the area of a disk of a given radius |
| 68 | /// |
| 69 | /// @see gtc_random |
| 70 | template<typename T> |
| 71 | GLM_FUNC_DECL vec<2, T, defaultp> diskRand(T Radius); |
| 72 | |
| 73 | /// Generate a random 3D vector which coordinates are regularly distributed within the volume of a ball of a given radius |
| 74 | /// |
| 75 | /// @see gtc_random |
| 76 | template<typename T> |
| 77 | GLM_FUNC_DECL vec<3, T, defaultp> ballRand(T Radius); |
| 78 | |
| 79 | /// @} |
| 80 | }//namespace glm |
| 81 | |
| 82 | #include "random.inl" |