aboutsummaryrefslogtreecommitdiff
path: root/q8
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-01-02 05:28:47 +0000
committerAkshay <[email protected]>2021-01-02 05:28:47 +0000
commit764fa9ab874bc27eb8b9836dc3368e816e163c45 (patch)
treed1b88982bfeb113a19f3c5684b639948aa778392 /q8
parentd3442e78f7fc56aa7c9d788ff5b04183b109f51f (diff)
fix rand stuff
Diffstat (limited to 'q8')
-rw-r--r--q8/rsa.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/q8/rsa.cpp b/q8/rsa.cpp
index c33bf7e..a322709 100644
--- a/q8/rsa.cpp
+++ b/q8/rsa.cpp
@@ -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
6using namespace std; 7using 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));