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.

37 lines
804B

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