Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. #include <random>
  2. #include <iostream>
  3. #include <time.h>
  4.  
  5. #include <limits>
  6. #include <cstddef>
  7. #include <iostream>
  8. #include "wektor.h"
  9. #include <limits>
  10.  
  11. typedef std::numeric_limits< double > dbl;
  12.  
  13. #define debug(x) std::cout << __LINE__ << ": " << #x << " == " << (x) << std::endl;
  14.  
  15. using namespace std;
  16.  
  17. bool toSamo(wektor3D w3d, double a, double b, double c)
  18. {
  19. if ((w3d.x == a) && (w3d.y == b) && (w3d.z == c))
  20. return true;
  21. return false;
  22. }
  23.  
  24. int main(int argc, char* argv[])
  25. {
  26. //srand(time(NULL));
  27. //mnozenie
  28.  
  29. double lower_bound = -1.0;
  30. double upper_bound = 1.0;// std::numeric_limits<double>::max();
  31. //std::uniform_real_distribution<double> unif(lower_bound, upper_bound);
  32. //std::default_random_engine re;
  33.  
  34. std::random_device rd; //Will be used to obtain a seed for the random number engine
  35. std::mt19937 gen(rd()); //Standard mersenne_twister_engine seeded with rd()
  36. std::uniform_real_distribution<> dis(lower_bound, upper_bound);
  37.  
  38.  
  39. int cnt = 0;
  40. while (1)
  41. {
  42. cnt++;
  43. wektor3D a(dis(gen), dis(gen), dis(gen));
  44. wektor3D b(dis(gen), dis(gen), dis(gen));
  45. //wektor3D a(1, 2, 3);
  46. //wektor3D b(2, 2, 2);
  47. if ((a * b != (a.x * b.x + a.y * b.y + a.z * b.z)))
  48. {
  49. cout << cnt << endl;
  50. debug(a);
  51. debug(b);
  52. break;
  53. }
  54. }
  55.  
  56.  
  57.  
  58. system("pause");
  59. return 0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement