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( 'x: %d, a: %d, b: %d, ln(F(x;a,b)): %d', x[ i ].toFixed( 4 ), a[ i ], b[ i ], v.toFixed( 4 ) );
142
+
}
143
+
```
144
+
145
+
</section>
146
+
147
+
<!-- /.examples -->
148
+
149
+
<!-- C interface documentation. -->
150
+
151
+
<sectionclass="c">
152
+
153
+
## C APIs
154
+
155
+
<!-- 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_logcdf( x, a, b )
174
+
175
+
Evaluates the natural logarithm of the [cumulative distribution function][cdf] (CDF) for a [discrete uniform][discrete-uniform-distribution] distribution with parameters `a` (minimum support) and `b` (maximum support).
176
+
177
+
```c
178
+
double out = stdlib_base_dists_discrete_uniform_logcdf( 9.0, 0, 10 );
179
+
// returns ~-0.095
180
+
```
181
+
182
+
The function accepts the following arguments:
183
+
184
+
-**x**: `[in] double` input value.
185
+
-**a**: `[in] int32_t` minimum support.
186
+
-**b**: `[in] int32_t` maximum support.
187
+
188
+
```c
189
+
doublestdlib_base_dists_discrete_uniform_logcdf( const double x, const int32_t a, const int32_t b );
190
+
```
191
+
192
+
</section>
193
+
194
+
<!-- /.usage -->
195
+
196
+
<!-- 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 );
219
+
return min + ( v*(max-min) );
220
+
}
221
+
222
+
int main( void ) {
223
+
int32_t a;
224
+
int32_t b;
225
+
double x;
226
+
double y;
227
+
int i;
228
+
229
+
for ( i = 0; i < 10; i++ ) {
230
+
x = random_uniform( -10.0, 10.0 );
231
+
a = stdlib_base_round( random_uniform( 0.0, 5.0 ) );
232
+
b = stdlib_base_round( random_uniform( a, a + 5.0 ) );
233
+
y = stdlib_base_dists_discrete_uniform_logcdf( x, a, b );
234
+
printf( "x:%lf, a: %d, b: %d, ln(F(X;a,b)): %lf\n", x, a, b, y );
235
+
}
143
236
}
144
237
```
145
238
146
239
</section>
147
240
148
241
<!-- /.examples -->
149
242
243
+
</section>
244
+
245
+
<!-- /.c -->
246
+
247
+
<!-- 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. -->
248
+
249
+
<sectionclass="references">
250
+
251
+
</section>
252
+
253
+
<!-- /.references -->
254
+
150
255
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
0 commit comments