From 72b1d56a5b839ded48aa3495e6828690004d4f7e Mon Sep 17 00:00:00 2001 From: Erick Chandra <erickchandra.1@gmail.com> Date: Fri, 12 Feb 2016 10:50:47 +0700 Subject: [PATCH] Initial with create random number. --- bucketsort.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 bucketsort.c diff --git a/bucketsort.c b/bucketsort.c new file mode 100644 index 0000000..eb58960 --- /dev/null +++ b/bucketsort.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <mpi.h> +#include <assert.h> + +float *create_rand_nums(int num_elements) { + float *rand_nums = (float *) malloc(sizeof(float) * num_elements); + assert(rand_nums != NULL); + int i; + for (i = 0; i < num_elements; i++) { + rand_nums[i] = (rand() / (float) RAND_MAX); + } + return rand_nums; +} -- GitLab