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.

18 lines
371B

  1. #pragma once
  2. #include <cstdint>
  3. #include <random>
  4. namespace SynthDevKit {
  5. class WhiteNoise {
  6. public:
  7. WhiteNoise (uint32_t seed) : rd { }, mt { rd() }, dist{ -5.0, 5.0 } { };
  8. void reset ( ) { };
  9. float stepValue ( ) { return dist(mt); };
  10. private:
  11. std::random_device rd;
  12. std::mt19937 mt;
  13. std::uniform_real_distribution<double> dist;
  14. };
  15. }