You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.log( 'p: %d, a: %d, b: %d, Q(p;a,b): %d', p[ i ].toFixed( 4 ), a[ i ], b[ i ], v );
147
146
}
148
147
```
149
148
150
149
</section>
151
150
152
151
<!-- /.examples -->
153
152
153
+
<!-- C interface documentation. -->
154
+
155
+
<sectionclass="c">
156
+
157
+
## C APIs
158
+
159
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
#### stdlib_base_dists_discrete_uniform_quantile( x, a, b )
178
+
179
+
Evaluates the [quantile function][quantile-function] for a [discrete uniform][discrete-uniform-distribution] distribution with parameters `a` (minimum support) and `b` (maximum support).
180
+
181
+
```c
182
+
double out = stdlib_base_dists_discrete_uniform_quantile( 0.8, 0, 1 );
183
+
// returns 1.0
184
+
```
185
+
186
+
The function accepts the following arguments:
187
+
188
+
-**p**: `[in] double` input probability.
189
+
-**a**: `[in] int32_t` minimum support.
190
+
-**b**: `[in] int32_t` maximum support.
191
+
192
+
```c
193
+
doublestdlib_base_dists_discrete_uniform_quantile( const double p, const int32_t a, const int32_t b );
194
+
```
195
+
196
+
</section>
197
+
198
+
<!-- /.usage -->
199
+
200
+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
223
+
return min + ( v*(max-min) );
224
+
}
225
+
226
+
int main( void ) {
227
+
int32_t a;
228
+
int32_t b;
229
+
double p;
230
+
double y;
231
+
int i;
232
+
233
+
for ( i = 0; i < 10; i++ ) {
234
+
p = random_uniform( 0.0, 1.0 );
235
+
a = stdlib_base_round( random_uniform( 0.0, 5.0 ) );
236
+
b = stdlib_base_round( random_uniform( a, a + 5.0 ) );
237
+
y = stdlib_base_dists_discrete_uniform_quantile( p, a, b );
238
+
printf( "p: %lf, a: %d, b: %d, Q(p;a,b): %lf\n", p, a, b, y );
239
+
}
240
+
}
241
+
```
242
+
243
+
</section>
244
+
245
+
<!-- /.examples -->
246
+
247
+
</section>
248
+
249
+
<!-- /.c -->
250
+
251
+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
252
+
253
+
<sectionclass="references">
254
+
255
+
</section>
256
+
257
+
<!-- /.references -->
258
+
154
259
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
0 commit comments