Functions.h 837 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /// @file
  2. /// Contains misc functions
  3. #ifndef ANKI_UTIL_FUNCTIONS_H
  4. #define ANKI_UTIL_FUNCTIONS_H
  5. #include <cstdint>
  6. #include <cstdlib> // For size_t
  7. namespace anki {
  8. /// @addtogroup util
  9. /// @{
  10. /// @addtogroup misc
  11. /// @{
  12. /// Pick a random number from min to max
  13. extern int randRange(int min, int max);
  14. /// Pick a random number from min to max
  15. extern uint32_t randRange(uint32_t min, uint32_t max);
  16. /// Pick a random number from min to max
  17. extern float randRange(float min, float max);
  18. /// Pick a random number from min to max
  19. extern double randRange(double min, double max);
  20. extern float randFloat(float max);
  21. /// Get the size in bytes of a vector
  22. template<typename Vec>
  23. extern size_t getVectorSizeInBytes(const Vec& v)
  24. {
  25. return v.size() * sizeof(typename Vec::value_type);
  26. }
  27. /// @}
  28. /// @}
  29. } // end namespace anki
  30. #endif