-
-
Save idat50me/c6e7e2a528586c8e6b1ad512b3255fe7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
#include "math/millor_rabin.cpp" | |
int main() { | |
random_device rng; | |
mt19937 mt(rng()); | |
uniform_int_distribution<long long> dist(1, 9000000000000000000ll); | |
int k = 1000000; // num of loops | |
chrono::system_clock::time_point s, t; | |
int ans = 0; | |
s = chrono::system_clock::now(); | |
while(k--) { | |
long long n = dist(mt); | |
if(isprime(n)) ans++; | |
} | |
t = chrono::system_clock::now(); | |
auto tm = chrono::duration_cast<chrono::milliseconds>(t - s).count(); | |
cout << ans << endl; | |
cout << tm << "[ms]" << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment