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.

35 lines
673B

  1. /***************************************************/
  2. /*! \class Noise
  3. \brief STK noise generator.
  4. Generic random number generation using the
  5. C rand() function. The quality of the rand()
  6. function varies from one OS to another.
  7. by Perry R. Cook and Gary P. Scavone, 1995--2017.
  8. */
  9. /***************************************************/
  10. #include "Noise.h"
  11. #include <time.h>
  12. namespace stk {
  13. Noise :: Noise( unsigned int seed )
  14. {
  15. // Seed the random number generator
  16. this->setSeed( seed );
  17. }
  18. void Noise :: setSeed( unsigned int seed )
  19. {
  20. if ( seed == 0 )
  21. srand( (unsigned int) time( NULL ) );
  22. else
  23. srand( seed );
  24. }
  25. } // stk namespace