static void init_random_x( const double *lo, const double *up, ptrdiff_t local_M, double *x ) { double tmp; for (ptrdiff_t j=0; j<local_M; j++){ for(int t=0; t<3; t++){ do{ tmp = random_number_less_than_one(); tmp = (up[t]-lo[t]) * tmp + lo[t]; } while( (tmp < -0.5) || (0.5 <= tmp) ); x[3*j+t] = tmp; } } }
static void init_random_x( const long double *lo, const long double *up, const long double *x_max, ptrdiff_t M, long double *x ) { long double tmp; for (ptrdiff_t j=0; j<M; j++){ for(int t=0; t<3; t++){ do{ tmp = random_number_less_than_one(); tmp = (up[t]-lo[t]) * tmp + lo[t]; } while( (tmp < -x_max[t]) || (x_max[t] <= tmp) ); x[3*j+t] = tmp; } } }