Advertisement
MeehoweCK

Untitled

Nov 19th, 2020
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. #define DIV (rand() - 1) / 32766.0      // defining a macro - everytime when we put DIV, it's replaced by this formula (rand() - 1) / 32766.0
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     srand(time(nullptr));
  12.  
  13.     double x = DIV;
  14.     cout << x << endl;
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement