22 namespace perception {
30 *s = 16807 * (*s - a * 127773) - 2836 * a;
34 return ((1.0 / (static_cast<double>(2147483647))) * (*s));
39 inline int IRandI(
int pool_size,
int *s) {
40 return (IIntervalHalfopen<int>(static_cast<int>(
IRandCoreD(s) * pool_size), 0,
50 for (
int i = 0; i < n; i++) {
51 sample[i] =
IRandI(pool_size, s);
54 for (
int i = 0; i < n; i++) {
56 temp =
IRandI(pool_size - i, s);
60 for (
int j = 0; j < i; j++) {
79 if (A == reinterpret_cast<T *>(NULL) || n <= 1 || l < 1) {
83 for (i = n - 1; i > 0; i--) {
85 ISwap(A + r * l, A + i * l, l);
95 if (A == reinterpret_cast<T *>(NULL) || B == reinterpret_cast<T *>(NULL) ||
96 n <= 1 || la < 1 || lb < 1) {
100 for (i = n - 1; i > 0; i--) {
102 ISwap(A + r * la, A + i * la, la);
103 ISwap(B + r * lb, B + i * lb, lb);
109 template <
typename T>
111 if (A == reinterpret_cast<T *>(NULL) || n <= 1) {
115 for (i = n - 1; i > 0; i--) {
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
void IRandomizedShuffle1(T *A, int n, int *s)
Definition: i_rand.h:110
const size_t A
Definition: util.h:160
int IRandI(int pool_size, int *s)
Definition: i_rand.h:39
void IRandomizedShuffle(T *A, int n, int l, int *s)
Definition: i_rand.h:78
double IRandCoreD(int *s)
Definition: i_rand.h:27
const int I_DEFAULT_SEED
Definition: i_rand.h:24
void IRandomSample(int *sample, int n, int pool_size, int *s)
Definition: i_rand.h:47
void ISwap(T &a, T &b)
Definition: i_basic.h:299