aircampro

random number generator

Aug 23rd, 2025 (edited)
256
0
Never
10
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.12 KB | Source Code | 0 0
  1. #include <iostream>
  2. #include <utility>
  3. #include <random>
  4. #include <iomanip>
  5. #include <mutex>
  6.  
  7. // --------------- template STL to generate random number of the type specified ------------
  8.         template <typename D>
  9.         class RandomGenerator {
  10.         public:
  11.             using result_type = typename D::result_type;
  12.             RandomGenerator(result_type min, result_type max) : _dist(min, max), _rgen(std::random_device()()) {}
  13.             result_type rand()
  14.             {
  15.                 std::lock_guard<std::mutex> lock(_mutex);
  16.                 return _dist(_rgen);
  17.             }
  18.  
  19.         private:
  20.             D _dist;
  21.             std::mt19937 _rgen;
  22.             std::mutex _mutex;
  23.         };
  24.         using rdist_double_t = std::uniform_real_distribution<double>;
  25.         using rdist_float_t = std::uniform_real_distribution<float>;
  26.         using rdist_int_t = std::uniform_int_distribution<int>;
  27.         using rdist_long_t = std::uniform_int_distribution<long>;
  28.         using rdist_longlong_t = std::uniform_int_distribution<long>;
  29.  
  30.         using rgen_double_t = RandomGenerator<rdist_double_t>;
  31.         using rgen_float_t = RandomGenerator<rdist_float_t>;
  32.         using rgen_int_t = RandomGenerator<rdist_int_t>;
  33.         using rgen_long_t = RandomGenerator<rdist_long_t>;
  34.         using rgen_longlong_t = RandomGenerator<rdist_longlong_t>;
  35.  
  36. int main() {
  37.         // to use a double generator
  38.         auto x = rgen_double_t(0.0, 1.0);
  39.         auto t = x.rand();
  40.         std::cout << t << std::endl;
  41.  
  42.         // to use a integer generator
  43.         auto z = rgen_int_t(0.0, 100.0);
  44.         auto w = z.rand();
  45.         std::cout << w << std::endl;
  46.  
  47.         // to use a float generator
  48.         auto y = rgen_float_t(0.0, 10.0);
  49.         auto m = y.rand();
  50.         std::cout << m << std::endl;
  51.  
  52.         // to use a long generator
  53.         auto a = rgen_long_t(0.0, 69770.0);
  54.         auto s = a.rand();
  55.         std::cout << s << std::endl;
  56.  
  57.         // to use a long long generator
  58.         auto g = rgen_longlong_t(0.0, 1000000.0);
  59.         auto b = g.rand();
  60.         std::cout << b << std::endl;
  61.   return 0;    
  62.  
  63. }
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Vikegci
    17 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • User was banned
Add Comment
Please, Sign In to add comment