easy.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include "random.h"
  3. namespace NPrivate {
  4. struct TRandom {
  5. inline operator unsigned char() {
  6. return RandomNumber<unsigned char>();
  7. }
  8. inline operator unsigned short() {
  9. return RandomNumber<unsigned short>();
  10. }
  11. inline operator unsigned int() {
  12. return RandomNumber<unsigned int>();
  13. }
  14. inline operator unsigned long() {
  15. return RandomNumber<unsigned long>();
  16. }
  17. inline operator unsigned long long() {
  18. return RandomNumber<unsigned long long>();
  19. }
  20. inline operator bool() {
  21. return RandomNumber<bool>();
  22. }
  23. inline operator float() {
  24. return RandomNumber<float>();
  25. }
  26. inline operator double() {
  27. return RandomNumber<double>();
  28. }
  29. inline operator long double() {
  30. return RandomNumber<long double>();
  31. }
  32. };
  33. } // namespace NPrivate
  34. static inline ::NPrivate::TRandom Random() noexcept {
  35. return {};
  36. }