Commit 3acb789f authored by James Willis's avatar James Willis
Browse files

Shuffle particles randomly after forming a cell.

parent 1828f66f
......@@ -31,14 +31,6 @@ enum velocity_types {
velocity_rotating
};
/**
* @brief Returns a random number (uniformly distributed) in [a,b[
*/
double random_uniform(double a, double b) {
return (rand() / (double)RAND_MAX) * (b - a) + a;
}
/**
* @brief Constructs a cell and all of its particle in a valid state prior to
* a DOPAIR or DOSELF calcuation.
......@@ -127,6 +119,8 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
cell->ti_end_min = 1;
cell->ti_end_max = 1;
shuffle_particles(cell->parts,cell->count);
cell->sorted = 0;
cell->sort = NULL;
cell->sortsize = 0;
......
......@@ -24,13 +24,6 @@
#include <unistd.h>
#include "swift.h"
/**
* Returns a random number (uniformly distributed) in [a,b[
*/
double random_uniform(double a, double b) {
return (rand() / (double)RAND_MAX) * (b - a) + a;
}
/* n is both particles per axis and box size:
* particles are generated on a mesh with unit spacing
*/
......@@ -93,6 +86,8 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
cell->ti_end_min = 1;
cell->ti_end_max = 1;
shuffle_particles(cell->parts,cell->count);
cell->sorted = 0;
cell->sort = NULL;
cell->sortsize = 0;
......
Supports Markdown
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