2 /* Copyright 2010-2014 NVIDIA Corporation. All rights reserved.
6 * The source code and/or documentation ("Licensed Deliverables") are
7 * subject to NVIDIA intellectual property rights under U.S. and
8 * international Copyright laws.
10 * The Licensed Deliverables contained herein are PROPRIETARY and
11 * CONFIDENTIAL to NVIDIA and are being provided under the terms and
12 * conditions of a form of NVIDIA software license agreement by and
13 * between NVIDIA and Licensee ("License Agreement") or electronically
14 * accepted by Licensee. Notwithstanding any terms or conditions to
15 * the contrary in the License Agreement, reproduction or disclosure
16 * of the Licensed Deliverables to any third party without the express
17 * written consent of NVIDIA is prohibited.
19 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20 * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21 * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
22 * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23 * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24 * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25 * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27 * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28 * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32 * OF THESE LICENSED DELIVERABLES.
34 * U.S. Government End Users. These Licensed Deliverables are a
35 * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36 * 1995), consisting of "commercial computer software" and "commercial
37 * computer software documentation" as such terms are used in 48
38 * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
39 * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40 * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41 * U.S. Government End Users acquire the Licensed Deliverables with
42 * only those rights set forth herein.
44 * Any use of the Licensed Deliverables in individual and commercial
45 * software must include, in the user documentation and internal
46 * comments to the code, the above Disclaimer and U.S. Government End
51 #if !defined(CURAND_NORMAL_H_)
52 #define CURAND_NORMAL_H_
55 * \defgroup DEVICE Device API
60 #include "curand_mrg32k3a.h"
61 #include "curand_mtgp32_kernel.h"
64 #include "curand_philox4x32_x.h"
65 #include "curand_normal_static.h"
67 QUALIFIERS float2 _curand_box_muller(unsigned int x, unsigned int y)
70 float u = x * CURAND_2POW32_INV + (CURAND_2POW32_INV/2);
71 float v = y * CURAND_2POW32_INV_2PI + (CURAND_2POW32_INV_2PI/2);
73 float s = sqrtf(-2.0f * logf(u));
74 __sincosf(v, &result.x, &result.y);
76 float s = sqrtf(-2.0f * logf(u));
85 QUALIFIERS float2 curand_box_muller_mrg(curandStateMRG32k3a_t * state)
88 x = curand_uniform(state);
89 y = curand_uniform(state) * CURAND_2PI;
92 float s = sqrtf(-2.0f * logf(x));
93 __sincosf(y, &result.x, &result.y);
95 float s = sqrtf(-2.0f * logf(x));
105 _curand_box_muller_double(unsigned int x0, unsigned int x1,
106 unsigned int y0, unsigned int y1)
109 unsigned long long zx = (unsigned long long)x0 ^
110 ((unsigned long long)x1 << (53 - 32));
111 double u = zx * CURAND_2POW53_INV_DOUBLE + (CURAND_2POW53_INV_DOUBLE/2.0);
112 unsigned long long zy = (unsigned long long)y0 ^
113 ((unsigned long long)y1 << (53 - 32));
114 double v = zy * (CURAND_2POW53_INV_DOUBLE*2.0) + CURAND_2POW53_INV_DOUBLE;
115 double s = sqrt(-2.0 * log(u));
117 #if __CUDA_ARCH__ > 0
118 sincospi(v, &result.x, &result.y);
120 result.x = sin(v*CURAND_PI_DOUBLE);
121 result.y = cos(v*CURAND_PI_DOUBLE);
130 curand_box_muller_mrg_double(curandStateMRG32k3a_t * state)
134 x = curand_uniform_double(state);
135 y = curand_uniform_double(state) * 2.0;
137 double s = sqrt(-2.0 * log(x));
138 #if __CUDA_ARCH__ > 0
139 sincospi(y, &result.x, &result.y);
141 result.x = sin(y*CURAND_PI_DOUBLE);
142 result.y = cos(y*CURAND_PI_DOUBLE);
149 template <typename R>
150 QUALIFIERS float2 curand_box_muller(R *state)
153 unsigned int x = curand(state);
154 unsigned int y = curand(state);
155 result = _curand_box_muller(x, y);
159 template <typename R>
160 QUALIFIERS float4 curand_box_muller4(R *state)
164 uint4 x = curand4(state);
165 //unsigned int y = curand(state);
166 _result = _curand_box_muller(x.x, x.y);
167 result.x = _result.x;
168 result.y = _result.y;
169 _result = _curand_box_muller(x.z, x.w);
170 result.z = _result.x;
171 result.w = _result.y;
175 template <typename R>
176 QUALIFIERS double2 curand_box_muller_double(R *state)
179 unsigned int x0 = curand(state);
180 unsigned int x1 = curand(state);
181 unsigned int y0 = curand(state);
182 unsigned int y1 = curand(state);
183 result = _curand_box_muller_double(x0, x1, y0, y1);
187 template <typename R>
188 QUALIFIERS double2 curand_box_muller2_double(R *state)
193 result = _curand_box_muller_double(_x.x, _x.y, _x.z, _x.w);
198 template <typename R>
199 QUALIFIERS double4 curand_box_muller4_double(R *state)
208 _res1 = _curand_box_muller_double(_x.x, _x.y, _x.z, _x.w);
209 _res2 = _curand_box_muller_double(_y.x, _y.y, _y.z, _y.w);
217 //QUALIFIERS float _curand_normal_icdf(unsigned int x)
219 //#if __CUDA_ARCH__ > 0 || defined(HOST_HAVE_ERFCINVF)
220 // float s = CURAND_SQRT2;
221 // // Mirror to avoid loss of precision
222 // if(x > 0x80000000UL) {
223 // x = 0xffffffffUL - x;
226 // float p = x * CURAND_2POW32_INV + (CURAND_2POW32_INV/2.0f);
227 // // p is in (0, 0.5], 2p is in (0, 1]
228 // return s * erfcinvf(2.0f * p);
230 // x++; //suppress warnings
235 //QUALIFIERS float _curand_normal_icdf(unsigned long long x)
237 //#if __CUDA_ARCH__ > 0 || defined(HOST_HAVE_ERFCINVF)
238 // unsigned int t = (unsigned int)(x >> 32);
239 // float s = CURAND_SQRT2;
240 // // Mirror to avoid loss of precision
241 // if(t > 0x80000000UL) {
242 // t = 0xffffffffUL - t;
245 // float p = t * CURAND_2POW32_INV + (CURAND_2POW32_INV/2.0f);
246 // // p is in (0, 0.5], 2p is in (0, 1]
247 // return s * erfcinvf(2.0f * p);
254 //QUALIFIERS double _curand_normal_icdf_double(unsigned int x)
256 //#if __CUDA_ARCH__ > 0 || defined(HOST_HAVE_ERFCINVF)
257 // double s = CURAND_SQRT2_DOUBLE;
258 // // Mirror to avoid loss of precision
259 // if(x > 0x80000000UL) {
260 // x = 0xffffffffUL - x;
263 // double p = x * CURAND_2POW32_INV_DOUBLE + (CURAND_2POW32_INV_DOUBLE/2.0);
264 // // p is in (0, 0.5], 2p is in (0, 1]
265 // return s * erfcinv(2.0 * p);
272 //QUALIFIERS double _curand_normal_icdf_double(unsigned long long x)
274 //#if __CUDA_ARCH__ > 0 || defined(HOST_HAVE_ERFCINVF)
275 // double s = CURAND_SQRT2_DOUBLE;
277 // // Mirror to avoid loss of precision
278 // if(x > 0x10000000000000UL) {
279 // x = 0x1fffffffffffffUL - x;
282 // double p = x * CURAND_2POW53_INV_DOUBLE + (CURAND_2POW53_INV_DOUBLE/2.0);
283 // // p is in (0, 0.5], 2p is in (0, 1]
284 // return s * erfcinv(2.0 * p);
293 * \brief Return a normally distributed float from an XORWOW generator.
295 * Return a single normally distributed float with mean \p 0.0f and
296 * standard deviation \p 1.0f from the XORWOW generator in \p state,
297 * increment position of generator by one.
299 * The implementation uses a Box-Muller transform to generate two
300 * normally distributed results, then returns them one at a time.
301 * See ::curand_normal2() for a more efficient version that returns
302 * both results at once.
304 * \param state - Pointer to state to update
306 * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f
308 QUALIFIERS float curand_normal(curandStateXORWOW_t *state)
310 if(state->boxmuller_flag != EXTRA_FLAG_NORMAL) {
314 float2 v = _curand_box_muller(x, y);
315 state->boxmuller_extra = v.y;
316 state->boxmuller_flag = EXTRA_FLAG_NORMAL;
319 state->boxmuller_flag = 0;
320 return state->boxmuller_extra;
324 * \brief Return a normally distributed float from an Philox4_32_10 generator.
326 * Return a single normally distributed float with mean \p 0.0f and
327 * standard deviation \p 1.0f from the Philox4_32_10 generator in \p state,
328 * increment position of generator by one.
330 * The implementation uses a Box-Muller transform to generate two
331 * normally distributed results, then returns them one at a time.
332 * See ::curand_normal2() for a more efficient version that returns
333 * both results at once.
335 * \param state - Pointer to state to update
337 * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f
340 QUALIFIERS float curand_normal(curandStatePhilox4_32_10_t *state)
342 if(state->boxmuller_flag != EXTRA_FLAG_NORMAL) {
346 float2 v = _curand_box_muller(x, y);
347 state->boxmuller_extra = v.y;
348 state->boxmuller_flag = EXTRA_FLAG_NORMAL;
351 state->boxmuller_flag = 0;
352 return state->boxmuller_extra;
358 * \brief Return a normally distributed float from an MRG32k3a generator.
360 * Return a single normally distributed float with mean \p 0.0f and
361 * standard deviation \p 1.0f from the MRG32k3a generator in \p state,
362 * increment position of generator by one.
364 * The implementation uses a Box-Muller transform to generate two
365 * normally distributed results, then returns them one at a time.
366 * See ::curand_normal2() for a more efficient version that returns
367 * both results at once.
369 * \param state - Pointer to state to update
371 * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f
373 QUALIFIERS float curand_normal(curandStateMRG32k3a_t *state)
375 if(state->boxmuller_flag != EXTRA_FLAG_NORMAL) {
376 float2 v = curand_box_muller_mrg(state);
377 state->boxmuller_extra = v.y;
378 state->boxmuller_flag = EXTRA_FLAG_NORMAL;
381 state->boxmuller_flag = 0;
382 return state->boxmuller_extra;
386 * \brief Return two normally distributed floats from an XORWOW generator.
388 * Return two normally distributed floats with mean \p 0.0f and
389 * standard deviation \p 1.0f from the XORWOW generator in \p state,
390 * increment position of generator by two.
392 * The implementation uses a Box-Muller transform to generate two
393 * normally distributed results.
395 * \param state - Pointer to state to update
397 * \return Normally distributed float2 where each element is from a
398 * distribution with mean \p 0.0f and standard deviation \p 1.0f
400 QUALIFIERS float2 curand_normal2(curandStateXORWOW_t *state)
402 return curand_box_muller(state);
405 * \brief Return two normally distributed floats from an Philox4_32_10 generator.
407 * Return two normally distributed floats with mean \p 0.0f and
408 * standard deviation \p 1.0f from the Philox4_32_10 generator in \p state,
409 * increment position of generator by two.
411 * The implementation uses a Box-Muller transform to generate two
412 * normally distributed results.
414 * \param state - Pointer to state to update
416 * \return Normally distributed float2 where each element is from a
417 * distribution with mean \p 0.0f and standard deviation \p 1.0f
419 QUALIFIERS float2 curand_normal2(curandStatePhilox4_32_10_t *state)
421 return curand_box_muller(state);
425 * \brief Return four normally distributed floats from an Philox4_32_10 generator.
427 * Return four normally distributed floats with mean \p 0.0f and
428 * standard deviation \p 1.0f from the Philox4_32_10 generator in \p state,
429 * increment position of generator by four.
431 * The implementation uses a Box-Muller transform to generate two
432 * normally distributed results.
434 * \param state - Pointer to state to update
436 * \return Normally distributed float2 where each element is from a
437 * distribution with mean \p 0.0f and standard deviation \p 1.0f
439 QUALIFIERS float4 curand_normal4(curandStatePhilox4_32_10_t *state)
441 return curand_box_muller4(state);
447 * \brief Return two normally distributed floats from an MRG32k3a generator.
449 * Return two normally distributed floats with mean \p 0.0f and
450 * standard deviation \p 1.0f from the MRG32k3a generator in \p state,
451 * increment position of generator by two.
453 * The implementation uses a Box-Muller transform to generate two
454 * normally distributed results.
456 * \param state - Pointer to state to update
458 * \return Normally distributed float2 where each element is from a
459 * distribution with mean \p 0.0f and standard deviation \p 1.0f
461 QUALIFIERS float2 curand_normal2(curandStateMRG32k3a_t *state)
463 return curand_box_muller_mrg(state);
467 * \brief Return a normally distributed float from a MTGP32 generator.
469 * Return a single normally distributed float with mean \p 0.0f and
470 * standard deviation \p 1.0f from the MTGP32 generator in \p state,
471 * increment position of generator.
473 * The implementation uses the inverse cumulative distribution function
474 * to generate normally distributed results.
476 * \param state - Pointer to state to update
478 * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f
480 QUALIFIERS float curand_normal(curandStateMtgp32_t *state)
482 return _curand_normal_icdf(curand(state));
485 * \brief Return a normally distributed float from a Sobol32 generator.
487 * Return a single normally distributed float with mean \p 0.0f and
488 * standard deviation \p 1.0f from the Sobol32 generator in \p state,
489 * increment position of generator by one.
491 * The implementation uses the inverse cumulative distribution function
492 * to generate normally distributed results.
494 * \param state - Pointer to state to update
496 * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f
498 QUALIFIERS float curand_normal(curandStateSobol32_t *state)
500 return _curand_normal_icdf(curand(state));
504 * \brief Return a normally distributed float from a scrambled Sobol32 generator.
506 * Return a single normally distributed float with mean \p 0.0f and
507 * standard deviation \p 1.0f from the scrambled Sobol32 generator in \p state,
508 * increment position of generator by one.
510 * The implementation uses the inverse cumulative distribution function
511 * to generate normally distributed results.
513 * \param state - Pointer to state to update
515 * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f
517 QUALIFIERS float curand_normal(curandStateScrambledSobol32_t *state)
519 return _curand_normal_icdf(curand(state));
523 * \brief Return a normally distributed float from a Sobol64 generator.
525 * Return a single normally distributed float with mean \p 0.0f and
526 * standard deviation \p 1.0f from the Sobol64 generator in \p state,
527 * increment position of generator by one.
529 * The implementation uses the inverse cumulative distribution function
530 * to generate normally distributed results.
532 * \param state - Pointer to state to update
534 * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f
536 QUALIFIERS float curand_normal(curandStateSobol64_t *state)
538 return _curand_normal_icdf(curand(state));
542 * \brief Return a normally distributed float from a scrambled Sobol64 generator.
544 * Return a single normally distributed float with mean \p 0.0f and
545 * standard deviation \p 1.0f from the scrambled Sobol64 generator in \p state,
546 * increment position of generator by one.
548 * The implementation uses the inverse cumulative distribution function
549 * to generate normally distributed results.
551 * \param state - Pointer to state to update
553 * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f
555 QUALIFIERS float curand_normal(curandStateScrambledSobol64_t *state)
557 return _curand_normal_icdf(curand(state));
561 * \brief Return a normally distributed double from an XORWOW generator.
563 * Return a single normally distributed double with mean \p 0.0 and
564 * standard deviation \p 1.0 from the XORWOW generator in \p state,
565 * increment position of generator.
567 * The implementation uses a Box-Muller transform to generate two
568 * normally distributed results, then returns them one at a time.
569 * See ::curand_normal2_double() for a more efficient version that returns
570 * both results at once.
572 * \param state - Pointer to state to update
574 * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0
576 QUALIFIERS double curand_normal_double(curandStateXORWOW_t *state)
578 if(state->boxmuller_flag_double != EXTRA_FLAG_NORMAL) {
579 unsigned int x0, x1, y0, y1;
584 double2 v = _curand_box_muller_double(x0, x1, y0, y1);
585 state->boxmuller_extra_double = v.y;
586 state->boxmuller_flag_double = EXTRA_FLAG_NORMAL;
589 state->boxmuller_flag_double = 0;
590 return state->boxmuller_extra_double;
594 * \brief Return a normally distributed double from an Philox4_32_10 generator.
596 * Return a single normally distributed double with mean \p 0.0 and
597 * standard deviation \p 1.0 from the Philox4_32_10 generator in \p state,
598 * increment position of generator.
600 * The implementation uses a Box-Muller transform to generate two
601 * normally distributed results, then returns them one at a time.
602 * See ::curand_normal2_double() for a more efficient version that returns
603 * both results at once.
605 * \param state - Pointer to state to update
607 * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0
610 QUALIFIERS double curand_normal_double(curandStatePhilox4_32_10_t *state)
612 if(state->boxmuller_flag_double != EXTRA_FLAG_NORMAL) {
615 double2 v = _curand_box_muller_double(_x.x, _x.y, _x.z, _x.w);
616 state->boxmuller_extra_double = v.y;
617 state->boxmuller_flag_double = EXTRA_FLAG_NORMAL;
620 state->boxmuller_flag_double = 0;
621 return state->boxmuller_extra_double;
626 * \brief Return a normally distributed double from an MRG32k3a generator.
628 * Return a single normally distributed double with mean \p 0.0 and
629 * standard deviation \p 1.0 from the XORWOW generator in \p state,
630 * increment position of generator.
632 * The implementation uses a Box-Muller transform to generate two
633 * normally distributed results, then returns them one at a time.
634 * See ::curand_normal2_double() for a more efficient version that returns
635 * both results at once.
637 * \param state - Pointer to state to update
639 * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0
641 QUALIFIERS double curand_normal_double(curandStateMRG32k3a_t *state)
643 if(state->boxmuller_flag_double != EXTRA_FLAG_NORMAL) {
644 double2 v = curand_box_muller_mrg_double(state);
645 state->boxmuller_extra_double = v.y;
646 state->boxmuller_flag_double = EXTRA_FLAG_NORMAL;
649 state->boxmuller_flag_double = 0;
650 return state->boxmuller_extra_double;
654 * \brief Return two normally distributed doubles from an XORWOW generator.
656 * Return two normally distributed doubles with mean \p 0.0 and
657 * standard deviation \p 1.0 from the XORWOW generator in \p state,
658 * increment position of generator by 2.
660 * The implementation uses a Box-Muller transform to generate two
661 * normally distributed results.
663 * \param state - Pointer to state to update
665 * \return Normally distributed double2 where each element is from a
666 * distribution with mean \p 0.0 and standard deviation \p 1.0
668 QUALIFIERS double2 curand_normal2_double(curandStateXORWOW_t *state)
670 return curand_box_muller_double(state);
674 * \brief Return two normally distributed doubles from an Philox4_32_10 generator.
676 * Return two normally distributed doubles with mean \p 0.0 and
677 * standard deviation \p 1.0 from the Philox4_32_10 generator in \p state,
678 * increment position of generator by 2.
680 * The implementation uses a Box-Muller transform to generate two
681 * normally distributed results.
683 * \param state - Pointer to state to update
685 * \return Normally distributed double2 where each element is from a
686 * distribution with mean \p 0.0 and standard deviation \p 1.0
688 QUALIFIERS double2 curand_normal2_double(curandStatePhilox4_32_10_t *state)
694 double2 v1 = _curand_box_muller_double(_x.x, _x.y, _x.z, _x.w);
702 QUALIFIERS double4 curand_normal4_double(curandStatePhilox4_32_10_t *state)
710 double2 v1 = _curand_box_muller_double(_x.x, _x.y, _x.z, _x.w);
711 double2 v2 = _curand_box_muller_double(_y.x, _y.y, _y.z, _y.w);
722 * \brief Return two normally distributed doubles from an MRG32k3a generator.
724 * Return two normally distributed doubles with mean \p 0.0 and
725 * standard deviation \p 1.0 from the MRG32k3a generator in \p state,
726 * increment position of generator.
728 * The implementation uses a Box-Muller transform to generate two
729 * normally distributed results.
731 * \param state - Pointer to state to update
733 * \return Normally distributed double2 where each element is from a
734 * distribution with mean \p 0.0 and standard deviation \p 1.0
736 QUALIFIERS double2 curand_normal2_double(curandStateMRG32k3a_t *state)
738 return curand_box_muller_mrg_double(state);
742 * \brief Return a normally distributed double from an MTGP32 generator.
744 * Return a single normally distributed double with mean \p 0.0 and
745 * standard deviation \p 1.0 from the MTGP32 generator in \p state,
746 * increment position of generator.
748 * The implementation uses the inverse cumulative distribution function
749 * to generate normally distributed results.
751 * \param state - Pointer to state to update
753 * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0
755 QUALIFIERS double curand_normal_double(curandStateMtgp32_t *state)
757 return _curand_normal_icdf_double(curand(state));
761 * \brief Return a normally distributed double from an Sobol32 generator.
763 * Return a single normally distributed double with mean \p 0.0 and
764 * standard deviation \p 1.0 from the Sobol32 generator in \p state,
765 * increment position of generator by one.
767 * The implementation uses the inverse cumulative distribution function
768 * to generate normally distributed results.
770 * \param state - Pointer to state to update
772 * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0
774 QUALIFIERS double curand_normal_double(curandStateSobol32_t *state)
776 return _curand_normal_icdf_double(curand(state));
780 * \brief Return a normally distributed double from a scrambled Sobol32 generator.
782 * Return a single normally distributed double with mean \p 0.0 and
783 * standard deviation \p 1.0 from the scrambled Sobol32 generator in \p state,
784 * increment position of generator by one.
786 * The implementation uses the inverse cumulative distribution function
787 * to generate normally distributed results.
789 * \param state - Pointer to state to update
791 * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0
793 QUALIFIERS double curand_normal_double(curandStateScrambledSobol32_t *state)
795 return _curand_normal_icdf_double(curand(state));
799 * \brief Return a normally distributed double from a Sobol64 generator.
801 * Return a single normally distributed double with mean \p 0.0 and
802 * standard deviation \p 1.0 from the Sobol64 generator in \p state,
803 * increment position of generator by one.
805 * The implementation uses the inverse cumulative distribution function
806 * to generate normally distributed results.
808 * \param state - Pointer to state to update
810 * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0
812 QUALIFIERS double curand_normal_double(curandStateSobol64_t *state)
814 return _curand_normal_icdf_double(curand(state));
818 * \brief Return a normally distributed double from a scrambled Sobol64 generator.
820 * Return a single normally distributed double with mean \p 0.0 and
821 * standard deviation \p 1.0 from the scrambled Sobol64 generator in \p state,
822 * increment position of generator by one.
824 * The implementation uses the inverse cumulative distribution function
825 * to generate normally distributed results.
827 * \param state - Pointer to state to update
829 * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0
831 QUALIFIERS double curand_normal_double(curandStateScrambledSobol64_t *state)
833 return _curand_normal_icdf_double(curand(state));
835 #endif // !defined(CURAND_NORMAL_H_)