This file contains hidden or 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
#ifndef PRIME_NUMBERS_H | |
#define PRIME_NUMBERS_H | |
#include <vector> | |
#include <algorithm> | |
template <typename NumberType> | |
/* | |
NumberType requires: | |
Construction from unsigned int; |
This file contains hidden or 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
template <typename Engine = std::mt19937> | |
class random_bits_generator | |
{ | |
Engine engine; | |
std::bernoulli_distribution distribution; | |
public: | |
template <typename OutputIt> | |
void operator()(OutputIt first, OutputIt last) | |
{ | |
while (first != last) |
This file contains hidden or 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
#pragma once | |
#include <chrono> | |
#include <utility> | |
template <class Func, class ... Args> | |
std::chrono::duration<double> measure(Func function, Args&& ... args) | |
{ | |
auto start = std::chrono::high_resolution_clock::now(); | |
function(std::forward<Args>(args)...); |
NewerOlder