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.

31 lines
652B

  1. #pragma once
  2. #include <stdint.h>
  3. #include <string>
  4. namespace rack {
  5. ////////////////////
  6. // RNG
  7. ////////////////////
  8. uint32_t randomu32();
  9. /** Returns a uniform random float in the interval [0.0, 1.0) */
  10. float randomf();
  11. /** Returns a normal random number with mean 0 and std dev 1 */
  12. float randomNormal();
  13. ////////////////////
  14. // Helper functions
  15. ////////////////////
  16. /** Converts a printf format string and optional arguments into a std::string */
  17. std::string stringf(const char *format, ...);
  18. /** Truncates and adds "..." to a string, not exceeding `len` characters */
  19. std::string ellipsize(std::string s, size_t len);
  20. } // namespace rack