From: stevenj Date: Thu, 6 Sep 2007 01:50:46 +0000 (-0400) Subject: allow NULL to be passed to sobol routines to fall back on pseudo-random X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=dd5c1f0915064eee6ed4d7ca595d86e7dd5fdae6;p=nlopt.git allow NULL to be passed to sobol routines to fall back on pseudo-random darcs-hash:20070906015046-c8de0-6a3da0b8e0b19d904995ceae6c5d798568a3c301.gz --- diff --git a/util/sobolseq.c b/util/sobolseq.c index c4d38cd..895152b 100644 --- a/util/sobolseq.c +++ b/util/sobolseq.c @@ -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;