IDRandomUtil.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef ID_RANDOM_UTIL_HPP_
  2. #define ID_RANDOM_UTIL_HPP_
  3. #include "BulletInverseDynamics/IDConfig.hpp"
  4. namespace btInverseDynamics {
  5. /// seed random number generator using time()
  6. void randomInit();
  7. /// seed random number generator with identical value to get repeatable results
  8. void randomInit(unsigned seed);
  9. /// Generate (not quite) uniformly distributed random integers in [low, high]
  10. /// Note: this is a low-quality implementation using only rand(), as
  11. /// C++11 <random> is not supported in bullet.
  12. /// The results will *not* be perfectly uniform.
  13. /// \param low is the lower bound (inclusive)
  14. /// \param high is the lower bound (inclusive)
  15. /// \return a random number within [\param low, \param high]
  16. int randomInt(int low, int high);
  17. /// Generate a (not quite) uniformly distributed random floats in [low, high]
  18. /// Note: this is a low-quality implementation using only rand(), as
  19. /// C++11 <random> is not supported in bullet.
  20. /// The results will *not* be perfectly uniform.
  21. /// \param low is the lower bound (inclusive)
  22. /// \param high is the lower bound (inclusive)
  23. /// \return a random number within [\param low, \param high]
  24. float randomFloat(float low, float high);
  25. /// generate a random valid mass value
  26. /// \returns random mass
  27. float randomMass();
  28. /// generate a random valid vector of principal moments of inertia
  29. vec3 randomInertiaPrincipal();
  30. /// generate a random valid moment of inertia matrix
  31. mat33 randomInertiaMatrix();
  32. /// generate a random unit vector
  33. vec3 randomAxis();
  34. }
  35. #endif