random.hpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #pragma once
  14. // Dependency:
  15. #include "../ext/scalar_int_sized.hpp"
  16. #include "../ext/scalar_uint_sized.hpp"
  17. #include "../detail/qualifier.hpp"
  18. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  19. # pragma message("GLM: GLM_GTC_random extension included")
  20. #endif
  21. namespace glm
  22. {
  23. /// @addtogroup gtc_random
  24. /// @{
  25. /// Generate random numbers in the interval [Min, Max], according a linear distribution
  26. ///
  27. /// @param Min Minimum value included in the sampling
  28. /// @param Max Maximum value included in the sampling
  29. /// @tparam genType Value type. Currently supported: float or double scalars.
  30. /// @see gtc_random
  31. template<typename genType>
  32. GLM_FUNC_DECL genType linearRand(genType Min, genType Max);
  33. /// Generate random numbers in the interval [Min, Max], according a linear distribution
  34. ///
  35. /// @param Min Minimum value included in the sampling
  36. /// @param Max Maximum value included in the sampling
  37. /// @tparam T Value type. Currently supported: float or double.
  38. ///
  39. /// @see gtc_random
  40. template<length_t L, typename T, qualifier Q>
  41. GLM_FUNC_DECL vec<L, T, Q> linearRand(vec<L, T, Q> const& Min, vec<L, T, Q> const& Max);
  42. /// Generate random numbers in the interval [Min, Max], according a gaussian distribution
  43. ///
  44. /// @see gtc_random
  45. template<typename genType>
  46. GLM_FUNC_DECL genType gaussRand(genType Mean, genType Deviation);
  47. /// Generate a random 2D vector which coordinates are regulary distributed on a circle of a given radius
  48. ///
  49. /// @see gtc_random
  50. template<typename T>
  51. GLM_FUNC_DECL vec<2, T, defaultp> circularRand(T Radius);
  52. /// Generate a random 3D vector which coordinates are regulary distributed on a sphere of a given radius
  53. ///
  54. /// @see gtc_random
  55. template<typename T>
  56. GLM_FUNC_DECL vec<3, T, defaultp> sphericalRand(T Radius);
  57. /// Generate a random 2D vector which coordinates are regulary distributed within the area of a disk of a given radius
  58. ///
  59. /// @see gtc_random
  60. template<typename T>
  61. GLM_FUNC_DECL vec<2, T, defaultp> diskRand(T Radius);
  62. /// Generate a random 3D vector which coordinates are regulary distributed within the volume of a ball of a given radius
  63. ///
  64. /// @see gtc_random
  65. template<typename T>
  66. GLM_FUNC_DECL vec<3, T, defaultp> ballRand(T Radius);
  67. /// @}
  68. }//namespace glm
  69. #include "random.inl"