27 static inline double drand(
double& seed)
30 int q = (int)(seed / 2147483647);
31 seed -= (double)q * 2147483647;
32 return seed / 2147483647;
37 static inline int irand(
double& seed,
int size) {
return (
int)(
drand(seed) * size); }
44 for (
int i = 0; i < xs.
size(); i++){
45 int pick = i +
irand(seed, xs.
size() - i);
56 for (
int i = 0; i < xs.size(); i++){
57 int pick = i +
irand(seed, xs.size() - i);
59 xs[pick].moveTo(xs[i]);
static void randomShuffle(double &seed, vec< T > &xs)
static int irand(double &seed, int size)
void moveTo(vec< T > &dest)
static double drand(double &seed)