chiark / gitweb /
allow NULL to be passed to sobol routines to fall back on pseudo-random
authorstevenj <stevenj@alum.mit.edu>
Thu, 6 Sep 2007 01:50:46 +0000 (21:50 -0400)
committerstevenj <stevenj@alum.mit.edu>
Thu, 6 Sep 2007 01:50:46 +0000 (21:50 -0400)
darcs-hash:20070906015046-c8de0-6a3da0b8e0b19d904995ceae6c5d798568a3c301.gz

util/sobolseq.c

index c4d38cdc72393baf8fc0254e3e8431cc6cde29ff..895152b8e648046646875007af56c367ab4e880a 100644 (file)
@@ -230,7 +230,7 @@ extern void nlopt_sobol_destroy(nlopt_sobol s)
 /* next vector x[sdim] in Sobol sequence, with each x[i] in (0,1) */
 void nlopt_sobol_next01(nlopt_sobol s, double *x)
 {
-     if (!sobol_gen(s, x)) {
+     if (!s || !sobol_gen(s, x)) {
          /* fall back on pseudo random numbers in the unlikely event
             that we exceed 2^32-1 points */
          unsigned i;