@@ -134,10 +134,24 @@ logEachMap( 'x: %0.4f, µ: %0.4f, σ: %0.4f, ln(f(x;µ,σ)): %0.4f', x, mu, sigm
134134
135135<!-- /.examples -->
136136
137- <!-- C usage documentation. -->
137+ <!-- C interface documentation. -->
138+
139+ * * *
138140
139141<section class =" c " >
140142
143+ ## C APIs
144+
145+ <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
146+
147+ <section class =" intro " >
148+
149+ </section >
150+
151+ <!-- /.intro -->
152+
153+ <!-- C usage documentation. -->
154+
141155<section class =" usage " >
142156
143157### Usage
@@ -177,23 +191,36 @@ double stdlib_base_dists_lognormal_logpdf( const double x, const double mu, cons
177191
178192<!-- /.notes -->
179193
194+ <!-- C API usage examples. -->
195+
180196<section class="examples">
181197
182198### Examples
183199
184200```c
185201#include "stdlib/stats/base/dists/lognormal/logpdf.h"
202+ #include <stdlib.h>
186203#include <stdio.h>
187204
205+ static double random_uniform( const double min, const double max ) {
206+ double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
207+ return min + ( v*(max-min) );
208+ }
209+
188210int main( void ) {
211+ double x;
212+ double mu;
213+ double sigma;
189214 double y;
190215 int i;
191216
192217 for ( i = 0; i < 25; i++ ) {
193- y = stdlib_base_dists_lognormal_logpdf( (double)i, 0.0, 1.0 );
194- printf( "x: %d, logpdf: %lf\n", i, y );
218+ x = random_uniform( 0.0, 100.0 );
219+ mu = random_uniform( -10.0, 10.0 );
220+ sigma = random_uniform( 0.1, 10.0 );
221+ y = stdlib_base_dists_lognormal_logpdf( x, mu, sigma );
222+ printf( "x: %lf, mu: %lf, sigma: %lf, ln(f(x;mu,sigma)): %lf\n", x, mu, sigma, y );
195223 }
196- return 0;
197224}
198225```
199226
0 commit comments