107 {
108 const int kWordWidth = 16;
109 const double kMean = 24108.0;
110 const double kStandardDeviation = 127.0;
111 const int kN = (1 << kWordWidth);
112 const int kNumEntries = kN >> 5;
113 unsigned int entries[kNumEntries];
114
116 memset(entries, 0, sizeof(unsigned int)*kNumEntries);
117
119 for (
int i = 0;
i < kWordWidth-1; ++
i) {
121 unsigned int rnd = rand.
nextU();
122 value |= ((rnd >> shift) & 0x1);
123 }
124
125
126 for (
int i = 0;
i < kN; ++
i) {
128 unsigned int rnd = rand.
nextU();
129 value |= ((rnd >> shift) & 0x1);
130
131 int index =
value & (kNumEntries-1);
133 int entry_shift = (
value >> (kWordWidth-5)) & 0x1f;
134 entries[index] |= (0x1 << entry_shift);
135 }
136
137
138 int total = 0;
139 for (
int i = 0;
i < kNumEntries; ++
i) {
140 unsigned int entry = entries[
i];
141 while (entry) {
142 total += (entry & 0x1);
143 entry >>= 1;
144 }
145 }
146
147
148 double z = ((kN-total)-kMean)/kStandardDeviation;
149
150
152
155}
static double normal_cdf(double z)
static constexpr int32_t SkLeftShift(int32_t value, int32_t shift)