Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include "generatorlosowy.h"
  2.  
  3. std::random_device GeneratorLosowy::device;
  4.  
  5. unsigned short GeneratorLosowy::losujPomiedzy(unsigned short min, unsigned short max)
  6. {
  7. if(min>max){
  8. unsigned short t = min;
  9. min = max;
  10. max = t;
  11. }
  12.  
  13. std::uniform_int_distribution<unsigned short>dist(min, max);
  14.  
  15. return dist(GeneratorLosowy::device);
  16. }
  17.  
  18. long GeneratorLosowy::losujPomiedzy(long min, long max)
  19. {
  20. if(min>max){
  21. long t = min;
  22. min = max;
  23. max = t;
  24. }
  25.  
  26. std::uniform_int_distribution<long> dist(min, max);
  27. return dist(GeneratorLosowy::device);
  28. }
  29.  
  30. int GeneratorLosowy::losujOdZeraDo(int max)
  31. {
  32. std::uniform_int_distribution<int> dist(0, max);
  33. return dist(GeneratorLosowy::device);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement