Faster random implementation

This commit is contained in:
David 2021-08-29 16:17:13 +02:00
commit 742ef283e4
7 changed files with 49 additions and 10 deletions

View file

@ -4,9 +4,16 @@
#include <math.h>
#include <memory>
#include "timer.hpp"
#include "random.h"
#define FAST_RANDOM 1
#ifdef FAST_RANDOM
pcg32_random_t pcg = { 0x853c49e6748fea9bULL, 0xda3e39cb94b95bdbULL };
#define rand() pcg32_random_r(&pcg)
#endif
/* Utility functions */
float degrees_to_radians(float d)
inline float degrees_to_radians(float d)
{
return d * M_PI / 180;
}