From e5f97aafca24667ed6780a92d9bd451c66454b44 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 3 Feb 2019 05:03:07 -0500 Subject: s/rand_src/rand/, mv km-rand{-src,}.c --- km-rand-src.c | 57 --------------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 km-rand-src.c (limited to 'km-rand-src.c') diff --git a/km-rand-src.c b/km-rand-src.c deleted file mode 100644 index 0ddc1bb..0000000 --- a/km-rand-src.c +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include "util.h" -#include "km.h" - -// fill buffer with N random floats -bool -km_rand_src_fill( - km_rand_src_t * const rs, - const size_t num_floats, - float * const floats -) { - return rs->cbs->fill(rs, num_floats, floats); -} - -// finalize random source -void -km_rand_src_fini( - km_rand_src_t * const rs -) { - if (rs->cbs->fini) { - rs->cbs->fini(rs); - } -} - -// fill callback for system random source -static bool -rand_src_system_on_fill( - km_rand_src_t * const rs, - const size_t num_floats, - float * const floats -) { - UNUSED(rs); - - // generate random cluster centers - for (size_t i = 0; i < num_floats; i++) { - floats[i] = 1.0 * rand() / RAND_MAX; - } - - // return success - return true; -} - -// system random source callbacks -static const km_rand_src_cbs_t -RAND_SRC_SYSTEM_CBS = { - .fill = rand_src_system_on_fill, - .fini = NULL, -}; - -// init system random source (uses system rand()) -void -km_rand_src_system_init( - km_rand_src_t * const rs -) { - rs->cbs = &RAND_SRC_SYSTEM_CBS; - rs->data = NULL; -} -- cgit v1.2.3