Skip to content

Instantly share code, notes, and snippets.

@idat50me
Created October 2, 2023 05:49
Show Gist options
  • Save idat50me/c6e7e2a528586c8e6b1ad512b3255fe7 to your computer and use it in GitHub Desktop.
Save idat50me/c6e7e2a528586c8e6b1ad512b3255fe7 to your computer and use it in GitHub Desktop.
#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