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.

random.hpp 556B

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