diff --git a/scratchpad/core.c b/scratchpad/core.c deleted file mode 100644 index 20b59e5..0000000 --- a/scratchpad/core.c +++ /dev/null @@ -1,27 +0,0 @@ - -uint64_t xorshift64(uint64_t* seed) -{ - // Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs" - // - uint64_t x = *seed; - x ^= x << 13; - x ^= x >> 7; - x ^= x << 17; - return *seed = x; -} - -double sample_unit_uniform(uint64_t* seed) -{ - // samples uniform from [0,1] interval. - return ((double)xorshift64(seed)) / ((double)UINT64_MAX); -} - -double sample_unit_normal(uint64_t* seed) -{ - // // See: - double u1 = sample_unit_uniform(seed); - double u2 = sample_unit_uniform(seed); - double z = sqrtf(-2.0 * log(u1)) * sin(2 * PI * u2); - return z; -} - diff --git a/scratchpad/quickselect/makefile b/scratchpad/quickselect/makefile new file mode 100644 index 0000000..c755523 --- /dev/null +++ b/scratchpad/quickselect/makefile @@ -0,0 +1,5 @@ +build: + gcc quickselect.c -lm -o quickselect + +run: + ./quickselect diff --git a/scratchpad/quickselect/quickselect b/scratchpad/quickselect/quickselect new file mode 100755 index 0000000..e3c99f2 Binary files /dev/null and b/scratchpad/quickselect/quickselect differ diff --git a/scratchpad/quickselect/quickselect.c b/scratchpad/quickselect/quickselect.c new file mode 100644 index 0000000..c3607f9 --- /dev/null +++ b/scratchpad/quickselect/quickselect.c @@ -0,0 +1,8 @@ +#include +#include +#include + +int main(){ + printf("Hello world!\n"); + return 0; +}