diff options
author | Akshay <[email protected]> | 2021-01-02 05:28:47 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2021-01-02 05:28:47 +0000 |
commit | 764fa9ab874bc27eb8b9836dc3368e816e163c45 (patch) | |
tree | d1b88982bfeb113a19f3c5684b639948aa778392 /q8 | |
parent | d3442e78f7fc56aa7c9d788ff5b04183b109f51f (diff) |
fix rand stuff
Diffstat (limited to 'q8')
-rw-r--r-- | q8/rsa.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -2,6 +2,7 @@ | |||
2 | #include <math.h> | 2 | #include <math.h> |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include <time.h> | ||
5 | 6 | ||
6 | using namespace std; | 7 | using namespace std; |
7 | 8 | ||
@@ -46,6 +47,7 @@ int main() { | |||
46 | cout << "Enter the text to be encrypted: "; | 47 | cout << "Enter the text to be encrypted: "; |
47 | cin.getline(text, sizeof(text)); | 48 | cin.getline(text, sizeof(text)); |
48 | len = strlen(text); | 49 | len = strlen(text); |
50 | srand(time(0)); | ||
49 | do { | 51 | do { |
50 | p = rand() % 800; | 52 | p = rand() % 800; |
51 | } while (!isprime(p)); | 53 | } while (!isprime(p)); |