RafalSobala

zad4/rand

Apr 6th, 2020
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6. int a=1,b=2;
  7. int main()
  8. {
  9.     cout << "Hello world!" << endl;
  10.     srand(time(NULL));
  11.     cout << a+rand()%(b-a+1);
  12.     //Są słobo losowe, wydaje mi sie ze przy tak małych liczbach cięzko o losowość, ponieważ program średnio uruchamiam co sekunde i przez to miałem ciągle jednakowy wynik
  13.     return 0;
  14. }
Add Comment
Please, Sign In to add comment