Skip to content
Snippets Groups Projects
Commit c1325c90 authored by Erick Chandra's avatar Erick Chandra
Browse files

Recommit for temporary use.

parent 72b1d56a
Branches master
No related merge requests found
......@@ -5,11 +5,30 @@
#include <assert.h>
float *create_rand_nums(int num_elements) {
time_t t;
// Initializes random number generator
srand((unsigned) time(&t));
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);
rand_nums[i] = (rand() % 50 / (float) RAND_MAX);
}
return rand_nums;
}
int main(int argc, char** argv) {
if (argc != 2) {
fprintf(stderr, "Usage: wrong argument count.\n");
exit(1);
}
float *rand_nums = NULL;
if (world_rank == 0) {
rand_nums = create_rand_nums(
}
return 0;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment