From aa74bd04f66217ff4d617924630b13d721578159 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 3 Feb 2019 16:12:04 -0500 Subject: add km_set_init_rand_points() --- km.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'km.h') diff --git a/km.h b/km.h index 82bd835..c70e13e 100644 --- a/km.h +++ b/km.h @@ -11,6 +11,7 @@ typedef struct km_rand_t_ km_rand_t; // random number source callbacks typedef struct { _Bool (*fill)(km_rand_t * const, const size_t, float * const); + _Bool (*fill_sizes)(km_rand_t * const, const size_t, size_t * const); void (*fini)(km_rand_t * const); } km_rand_cbs_t; @@ -23,6 +24,9 @@ struct km_rand_t_ { // fill buffer with N random floats _Bool km_rand_fill(km_rand_t * const, const size_t, float * const); +// fill buffer with N random size_ts +_Bool km_rand_fill_sizes(km_rand_t * const, const size_t, size_t * const); + // finalize random source void km_rand_fini(km_rand_t * const); @@ -82,6 +86,15 @@ _Bool km_set_init_rand_clusters( km_rand_t * ); +// init a set with num_clusters clusters of random points from the +// given set +_Bool km_set_init_rand_points( + km_set_t * const, + const km_set_t * const, + const size_t, + km_rand_t * +); + typedef struct { float d2; size_t cluster; -- cgit v1.2.3