Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include "a.h"
  2.  
  3. using namespace std;
  4.  
  5. template <class T>
  6. a<T>::a(double w_to_be) { //pairnei san orisma to 4 * r opou r h mesi apostasi vectors
  7. w = w_to_be;
  8.  
  9. //http://www.cplusplus.com/reference/random/uniform_real_distribution/
  10. const double range_from = 0; //[
  11. const double range_to = w; //)
  12. std::random_device rand_dev;
  13. std::mt19937 generator(rand_dev());
  14. std::uniform_real_distribution<double> distr(range_from, range_to);
  15. si = distr(generator);
  16. }
  17.  
  18. template <class T>
  19. a<T>::~a() {}
  20.  
  21. template <class T>
  22. int a<T>::get_a(T coordinate) { //pairnei san orisma ena coordinate enos vector (tupou double) kai epistrefei to ai(xi)
  23. double result = 0;
  24. result = coordinate - si;
  25. return floor(result / w);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement