chiark / gitweb /
move some util tests from comments into separate files
[nlopt.git] / util / mt19937ar_test.c
1 #include <stdio.h>
2 #include "nlopt-util.h"
3
4 int main(void)
5 {
6     int i;
7     /*
8     uint32_t init[4]={0x123, 0x234, 0x345, 0x456}, length=4;
9     nlopt_init_by_array(init, length);
10     */
11     nlopt_init_genrand(5489UL);
12     /* nlopt_genrand_int32 */
13     printf("1000 outputs of nlopt_iurand()\n");
14     for (i=0; i<1000; i++) {
15         printf("%10d ", nlopt_iurand(0x7fff));
16         if (i%5==4) printf("\n");
17     }
18     /* genrand_real2 */
19     printf("\n1000 outputs of nlopt_urand()\n");
20     for (i=0; i<1000; i++) {
21         printf("%10.8f ", nlopt_urand(0,1));
22         if (i%5==4) printf("\n");
23     }
24     return 0;
25 }