You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
781B

  1. #pragma once
  2. #include <cstdint>
  3. #include "common.hpp"
  4. namespace rack {
  5. namespace random {
  6. /** Seeds the RNG with the current time */
  7. void init();
  8. /** Returns a uniform random uint32_t from 0 to UINT32_MAX */
  9. uint32_t u32();
  10. uint64_t u64();
  11. /** Returns a uniform random float in the interval [0.0, 1.0) */
  12. float uniform();
  13. /** Returns a normal random number with mean 0 and standard deviation 1 */
  14. float normal();
  15. } // namespace random
  16. DEPRECATED inline float randomu32() {return random::u32();}
  17. DEPRECATED inline float randomu64() {return random::u64();}
  18. DEPRECATED inline float randomUniform() {return random::uniform();}
  19. DEPRECATED inline float randomNormal() {return random::normal();}
  20. DEPRECATED inline float randomf() {return random::uniform();}
  21. } // namespace rack