We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
generateNormal and generateNormalDouble raise errors when size is odd
When `curand.generateNormal` is called with argument `size` odd (as long as I investigated).
For example, the following code fails.

```
In [84]: generator = curand.createGenerator(curand.CURAND_RNG_PSEUDO_DEFAULT)
In [85]: curand.generateNormal(generator, out.data.ptr, 1, 0.0, 1.0)
```

The error message is as follows:

```
CURANDError                               Traceback (most recent call last)
<ipython-input-85-e3c65b1a19eb> in <module>()
----> 1 curand.generateNormal(generator, out.data.ptr, 1, 0.0, 1.0)

/home/delta/dev/chainer/cupy/cuda/curand.py in generateNormal(generator, outputPtr, n, mean, stddev)
    185     status = _curand.curandGenerateNormal(generator, outputPtr, n, mean,
    186                                           stddev)
--> 187     check_status(status)
    188 
    189 

/home/delta/dev/chainer/cupy/cuda/curand.py in check_status(status)
     77 def check_status(status):
     78     if status != 0:
---> 79         raise CURANDError(status)
     80 
     81 ###############################################################################

CURANDError: CURAND_STATUS_LENGTH_NOT_MULTIPLE
```

But when `size` is even, no error is raised.

```
In [86]: curand.generateNormal(generator, out.data.ptr, 2, 0.0, 1.0)
```

The situation is true for `curand.generateNormalDouble`.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cupy/cuda/curand.py`
Content:
```
1 """Thin wrapper of cuRAND."""
2 import ctypes
3 import sys
4 
5 from cupy.cuda import internal
6 from cupy.cuda import runtime
7 
8 if 'win32' == sys.platform:
9     _curand = internal.load_library(
10         internal.get_windows_cuda_library_names('curand'))
11 else:
12     _curand = internal.load_library('curand')
13 
14 _I = ctypes.c_int
15 _U = ctypes.c_uint
16 _S = ctypes.c_size_t
17 _ULL = ctypes.c_ulonglong
18 _P = ctypes.c_void_p
19 _IP = ctypes.POINTER(_I)
20 _UP = ctypes.POINTER(_U)
21 _ULLP = ctypes.POINTER(_ULL)
22 _F = ctypes.c_float
23 _D = ctypes.c_double
24 _FP = ctypes.POINTER(_F)
25 _DP = ctypes.POINTER(_D)
26 
27 CURAND_RNG_PSEUDO_DEFAULT = 100
28 CURAND_RNG_PSEUDO_XORWOW = 101
29 CURAND_RNG_PSEUDO_MRG32K3A = 121
30 CURAND_RNG_PSEUDO_MTGP32 = 141
31 CURAND_RNG_PSEUDO_MT19937 = 142
32 CURAND_RNG_PSEUDO_PHILOX4_32_10 = 161
33 CURAND_RNG_QUASI_DEFAULT = 200
34 CURAND_RNG_QUASI_SOBOL32 = 201
35 CURAND_RNG_QUASI_SCRAMBLED_SOBOL32 = 202
36 CURAND_RNG_QUASI_SOBOL64 = 203
37 CURAND_RNG_QUASI_SCRAMBLED_SOBOL64 = 204
38 
39 CURAND_ORDERING_PSEUDO_BEST = 100
40 CURAND_ORDERING_PSEUDO_DEFAULT = 101
41 CURAND_ORDERING_PSEUDO_SEEDED = 102
42 CURAND_ORDERING_QUASI_DEFAULT = 201
43 
44 Generator = _P
45 Distribution = _DP
46 
47 DiscreteDistribution = _P
48 
49 ###############################################################################
50 # Error handling
51 ###############################################################################
52 
53 STATUS = {
54     0: 'CURAND_STATUS_SUCCESS',
55     100: 'CURAND_STATUS_VERSION_MISMATCH',
56     101: 'CURAND_STATUS_NOT_INITIALIZED',
57     102: 'CURAND_STATUS_ALLOCATION_FAILED',
58     103: 'CURAND_STATUS_TYPE_ERROR',
59     104: 'CURAND_STATUS_OUT_OF_RANGE',
60     105: 'CURAND_STATUS_LENGTH_NOT_MULTIPLE',
61     106: 'CURAND_STATUS_DOUBLE_PRECISION_REQUIRED',
62     201: 'CURAND_STATUS_LAUNCH_FAILURE',
63     202: 'CURAND_STATUS_PREEXISTING_FAILURE',
64     203: 'CURAND_STATUS_INITIALIZATION_FAILED',
65     204: 'CURAND_STATUS_ARCH_MISMATCH',
66     999: 'CURAND_STATUS_INTERNAL_ERROR',
67 }
68 
69 
70 class CURANDError(RuntimeError):
71 
72     def __init__(self, status):
73         self.status = status
74         super(CURANDError, self).__init__(STATUS[status])
75 
76 
77 def check_status(status):
78     if status != 0:
79         raise CURANDError(status)
80 
81 ###############################################################################
82 # Generator
83 ###############################################################################
84 
85 _curand.curandCreateGenerator.argtypes = (_P, _I)
86 
87 
88 def createGenerator(rng_type):
89     generator = Generator()
90     status = _curand.curandCreateGenerator(ctypes.byref(generator), rng_type)
91     check_status(status)
92     return generator
93 
94 
95 _curand.curandDestroyGenerator.argtypes = (Generator,)
96 
97 
98 def destroyGenerator(generator):
99     status = _curand.curandDestroyGenerator(generator)
100     check_status(status)
101 
102 
103 _curand.curandGetVersion.argtypes = (_IP,)
104 
105 
106 def getVersion():
107     version = _I()
108     status = _curand.curandGetVersion(ctypes.byref(version))
109     check_status(status)
110     return version
111 
112 
113 _curand.curandSetStream.argtypes = (Generator, runtime.Stream)
114 
115 
116 def setStream(generator, stream):
117     status = _curand.curandSetStream(generator, stream)
118     check_status(status)
119 
120 
121 _curand.curandSetPseudoRandomGeneratorSeed.argtypes = (Generator, _ULL)
122 
123 
124 def setPseudoRandomGeneratorSeed(generator, seed):
125     status = _curand.curandSetPseudoRandomGeneratorSeed(generator, seed)
126     check_status(status)
127 
128 
129 _curand.curandSetGeneratorOffset.argtypes = (Generator, _ULL)
130 
131 
132 def setGeneratorOffset(generator, offset):
133     status = _curand.curandSetGeneratorOffset(generator, offset)
134     check_status(status)
135 
136 
137 _curand.curandSetGeneratorOrdering.argtypes = (Generator, _I)
138 
139 
140 def setGeneratorOrdering(generator, order):
141     status = _curand.curandSetGeneratorOrdering(generator, order)
142     check_status(status)
143 
144 
145 ###############################################################################
146 # Generation functions
147 ###############################################################################
148 
149 _curand.curandGenerate.argtypes = (Generator, _P, _S)
150 
151 
152 def generate(generator, outputPtr, num):
153     status = _curand.curandGenerate(generator, outputPtr, num)
154     check_status(status)
155 
156 
157 _curand.curandGenerateLongLong.argtypes = (Generator, _P, _S)
158 
159 
160 def generateLongLong(generator, outputPtr, num):
161     status = _curand.curandGenerateLongLong(generator, outputPtr, num)
162     check_status(status)
163 
164 
165 _curand.curandGenerateUniform.argtypes = (Generator, _P, _S)
166 
167 
168 def generateUniform(generator, outputPtr, num):
169     status = _curand.curandGenerateUniform(generator, outputPtr, num)
170     check_status(status)
171 
172 
173 _curand.curandGenerateUniformDouble.argtypes = (Generator, _P, _S)
174 
175 
176 def generateUniformDouble(generator, outputPtr, num):
177     status = _curand.curandGenerateUniformDouble(generator, outputPtr, num)
178     check_status(status)
179 
180 
181 _curand.curandGenerateNormal.argtypes = (Generator, _P, _S, _F, _F)
182 
183 
184 def generateNormal(generator, outputPtr, n, mean, stddev):
185     status = _curand.curandGenerateNormal(generator, outputPtr, n, mean,
186                                           stddev)
187     check_status(status)
188 
189 
190 _curand.curandGenerateNormalDouble.argtypes = (Generator, _P, _S, _D, _D)
191 
192 
193 def generateNormalDouble(generator, outputPtr, n, mean, stddev):
194     status = _curand.curandGenerateNormalDouble(generator, outputPtr, n, mean,
195                                                 stddev)
196     check_status(status)
197 
198 
199 _curand.curandGenerateLogNormal.argtypes = (Generator, _P, _S, _F, _F)
200 
201 
202 def generateLogNormal(generator, outputPtr, n, mean, stddev):
203     status = _curand.curandGenerateLogNormal(generator, outputPtr, n,
204                                              mean, stddev)
205     check_status(status)
206 
207 
208 _curand.curandGenerateLogNormalDouble.argtypes = (Generator, _P, _S, _D, _D)
209 
210 
211 def generateLogNormalDouble(generator, outputPtr, n, mean, stddev):
212     status = _curand.curandGenerateLogNormalDouble(generator, outputPtr, n,
213                                                    mean, stddev)
214     check_status(status)
215 
216 
217 _curand.curandGeneratePoisson.argtypes = (Generator, _P, _S, _D)
218 
219 
220 def generatePoisson(generator, outputPtr, n, lam):
221     status = _curand.curandGeneratePoisson(generator, outputPtr, n, lam)
222     check_status(status)
223
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cupy/cuda/curand.py b/cupy/cuda/curand.py
--- a/cupy/cuda/curand.py
+++ b/cupy/cuda/curand.py
@@ -182,6 +182,10 @@
 
 
 def generateNormal(generator, outputPtr, n, mean, stddev):
+    if n % 2 == 1:
+        msg = 'curandGenerateNormal can only generate even number of '\
+              'random variables simultaneously. See issue #390 for detail.'
+        raise ValueError(msg)
     status = _curand.curandGenerateNormal(generator, outputPtr, n, mean,
                                           stddev)
     check_status(status)
@@ -191,6 +195,10 @@
 
 
 def generateNormalDouble(generator, outputPtr, n, mean, stddev):
+    if n % 2 == 1:
+        msg = 'curandGenerateNormalDouble can only generate even number of '\
+              'random variables simultaneously. See issue #390 for detail.'
+        raise ValueError(msg)
     status = _curand.curandGenerateNormalDouble(generator, outputPtr, n, mean,
                                                 stddev)
     check_status(status)

{"golden_diff": "diff --git a/cupy/cuda/curand.py b/cupy/cuda/curand.py\n--- a/cupy/cuda/curand.py\n+++ b/cupy/cuda/curand.py\n@@ -182,6 +182,10 @@\n \n \n def generateNormal(generator, outputPtr, n, mean, stddev):\n+    if n % 2 == 1:\n+        msg = 'curandGenerateNormal can only generate even number of '\\\n+              'random variables simultaneously. See issue #390 for detail.'\n+        raise ValueError(msg)\n     status = _curand.curandGenerateNormal(generator, outputPtr, n, mean,\n                                           stddev)\n     check_status(status)\n@@ -191,6 +195,10 @@\n \n \n def generateNormalDouble(generator, outputPtr, n, mean, stddev):\n+    if n % 2 == 1:\n+        msg = 'curandGenerateNormalDouble can only generate even number of '\\\n+              'random variables simultaneously. See issue #390 for detail.'\n+        raise ValueError(msg)\n     status = _curand.curandGenerateNormalDouble(generator, outputPtr, n, mean,\n                                                 stddev)\n     check_status(status)\n", "issue": "generateNormal and generateNormalDouble raise errors when size is odd\nWhen `curand.generateNormal` is called with argument `size` odd (as long as I investigated).\nFor example, the following code fails.\n\n```\nIn [84]: generator = curand.createGenerator(curand.CURAND_RNG_PSEUDO_DEFAULT)\nIn [85]: curand.generateNormal(generator, out.data.ptr, 1, 0.0, 1.0)\n```\n\nThe error message is as follows:\n\n```\nCURANDError                               Traceback (most recent call last)\n<ipython-input-85-e3c65b1a19eb> in <module>()\n----> 1 curand.generateNormal(generator, out.data.ptr, 1, 0.0, 1.0)\n\n/home/delta/dev/chainer/cupy/cuda/curand.py in generateNormal(generator, outputPtr, n, mean, stddev)\n    185     status = _curand.curandGenerateNormal(generator, outputPtr, n, mean,\n    186                                           stddev)\n--> 187     check_status(status)\n    188 \n    189 \n\n/home/delta/dev/chainer/cupy/cuda/curand.py in check_status(status)\n     77 def check_status(status):\n     78     if status != 0:\n---> 79         raise CURANDError(status)\n     80 \n     81 ###############################################################################\n\nCURANDError: CURAND_STATUS_LENGTH_NOT_MULTIPLE\n```\n\nBut when `size` is even, no error is raised.\n\n```\nIn [86]: curand.generateNormal(generator, out.data.ptr, 2, 0.0, 1.0)\n```\n\nThe situation is true for `curand.generateNormalDouble`.\n\n", "before_files": [{"content": "\"\"\"Thin wrapper of cuRAND.\"\"\"\nimport ctypes\nimport sys\n\nfrom cupy.cuda import internal\nfrom cupy.cuda import runtime\n\nif 'win32' == sys.platform:\n    _curand = internal.load_library(\n        internal.get_windows_cuda_library_names('curand'))\nelse:\n    _curand = internal.load_library('curand')\n\n_I = ctypes.c_int\n_U = ctypes.c_uint\n_S = ctypes.c_size_t\n_ULL = ctypes.c_ulonglong\n_P = ctypes.c_void_p\n_IP = ctypes.POINTER(_I)\n_UP = ctypes.POINTER(_U)\n_ULLP = ctypes.POINTER(_ULL)\n_F = ctypes.c_float\n_D = ctypes.c_double\n_FP = ctypes.POINTER(_F)\n_DP = ctypes.POINTER(_D)\n\nCURAND_RNG_PSEUDO_DEFAULT = 100\nCURAND_RNG_PSEUDO_XORWOW = 101\nCURAND_RNG_PSEUDO_MRG32K3A = 121\nCURAND_RNG_PSEUDO_MTGP32 = 141\nCURAND_RNG_PSEUDO_MT19937 = 142\nCURAND_RNG_PSEUDO_PHILOX4_32_10 = 161\nCURAND_RNG_QUASI_DEFAULT = 200\nCURAND_RNG_QUASI_SOBOL32 = 201\nCURAND_RNG_QUASI_SCRAMBLED_SOBOL32 = 202\nCURAND_RNG_QUASI_SOBOL64 = 203\nCURAND_RNG_QUASI_SCRAMBLED_SOBOL64 = 204\n\nCURAND_ORDERING_PSEUDO_BEST = 100\nCURAND_ORDERING_PSEUDO_DEFAULT = 101\nCURAND_ORDERING_PSEUDO_SEEDED = 102\nCURAND_ORDERING_QUASI_DEFAULT = 201\n\nGenerator = _P\nDistribution = _DP\n\nDiscreteDistribution = _P\n\n###############################################################################\n# Error handling\n###############################################################################\n\nSTATUS = {\n    0: 'CURAND_STATUS_SUCCESS',\n    100: 'CURAND_STATUS_VERSION_MISMATCH',\n    101: 'CURAND_STATUS_NOT_INITIALIZED',\n    102: 'CURAND_STATUS_ALLOCATION_FAILED',\n    103: 'CURAND_STATUS_TYPE_ERROR',\n    104: 'CURAND_STATUS_OUT_OF_RANGE',\n    105: 'CURAND_STATUS_LENGTH_NOT_MULTIPLE',\n    106: 'CURAND_STATUS_DOUBLE_PRECISION_REQUIRED',\n    201: 'CURAND_STATUS_LAUNCH_FAILURE',\n    202: 'CURAND_STATUS_PREEXISTING_FAILURE',\n    203: 'CURAND_STATUS_INITIALIZATION_FAILED',\n    204: 'CURAND_STATUS_ARCH_MISMATCH',\n    999: 'CURAND_STATUS_INTERNAL_ERROR',\n}\n\n\nclass CURANDError(RuntimeError):\n\n    def __init__(self, status):\n        self.status = status\n        super(CURANDError, self).__init__(STATUS[status])\n\n\ndef check_status(status):\n    if status != 0:\n        raise CURANDError(status)\n\n###############################################################################\n# Generator\n###############################################################################\n\n_curand.curandCreateGenerator.argtypes = (_P, _I)\n\n\ndef createGenerator(rng_type):\n    generator = Generator()\n    status = _curand.curandCreateGenerator(ctypes.byref(generator), rng_type)\n    check_status(status)\n    return generator\n\n\n_curand.curandDestroyGenerator.argtypes = (Generator,)\n\n\ndef destroyGenerator(generator):\n    status = _curand.curandDestroyGenerator(generator)\n    check_status(status)\n\n\n_curand.curandGetVersion.argtypes = (_IP,)\n\n\ndef getVersion():\n    version = _I()\n    status = _curand.curandGetVersion(ctypes.byref(version))\n    check_status(status)\n    return version\n\n\n_curand.curandSetStream.argtypes = (Generator, runtime.Stream)\n\n\ndef setStream(generator, stream):\n    status = _curand.curandSetStream(generator, stream)\n    check_status(status)\n\n\n_curand.curandSetPseudoRandomGeneratorSeed.argtypes = (Generator, _ULL)\n\n\ndef setPseudoRandomGeneratorSeed(generator, seed):\n    status = _curand.curandSetPseudoRandomGeneratorSeed(generator, seed)\n    check_status(status)\n\n\n_curand.curandSetGeneratorOffset.argtypes = (Generator, _ULL)\n\n\ndef setGeneratorOffset(generator, offset):\n    status = _curand.curandSetGeneratorOffset(generator, offset)\n    check_status(status)\n\n\n_curand.curandSetGeneratorOrdering.argtypes = (Generator, _I)\n\n\ndef setGeneratorOrdering(generator, order):\n    status = _curand.curandSetGeneratorOrdering(generator, order)\n    check_status(status)\n\n\n###############################################################################\n# Generation functions\n###############################################################################\n\n_curand.curandGenerate.argtypes = (Generator, _P, _S)\n\n\ndef generate(generator, outputPtr, num):\n    status = _curand.curandGenerate(generator, outputPtr, num)\n    check_status(status)\n\n\n_curand.curandGenerateLongLong.argtypes = (Generator, _P, _S)\n\n\ndef generateLongLong(generator, outputPtr, num):\n    status = _curand.curandGenerateLongLong(generator, outputPtr, num)\n    check_status(status)\n\n\n_curand.curandGenerateUniform.argtypes = (Generator, _P, _S)\n\n\ndef generateUniform(generator, outputPtr, num):\n    status = _curand.curandGenerateUniform(generator, outputPtr, num)\n    check_status(status)\n\n\n_curand.curandGenerateUniformDouble.argtypes = (Generator, _P, _S)\n\n\ndef generateUniformDouble(generator, outputPtr, num):\n    status = _curand.curandGenerateUniformDouble(generator, outputPtr, num)\n    check_status(status)\n\n\n_curand.curandGenerateNormal.argtypes = (Generator, _P, _S, _F, _F)\n\n\ndef generateNormal(generator, outputPtr, n, mean, stddev):\n    status = _curand.curandGenerateNormal(generator, outputPtr, n, mean,\n                                          stddev)\n    check_status(status)\n\n\n_curand.curandGenerateNormalDouble.argtypes = (Generator, _P, _S, _D, _D)\n\n\ndef generateNormalDouble(generator, outputPtr, n, mean, stddev):\n    status = _curand.curandGenerateNormalDouble(generator, outputPtr, n, mean,\n                                                stddev)\n    check_status(status)\n\n\n_curand.curandGenerateLogNormal.argtypes = (Generator, _P, _S, _F, _F)\n\n\ndef generateLogNormal(generator, outputPtr, n, mean, stddev):\n    status = _curand.curandGenerateLogNormal(generator, outputPtr, n,\n                                             mean, stddev)\n    check_status(status)\n\n\n_curand.curandGenerateLogNormalDouble.argtypes = (Generator, _P, _S, _D, _D)\n\n\ndef generateLogNormalDouble(generator, outputPtr, n, mean, stddev):\n    status = _curand.curandGenerateLogNormalDouble(generator, outputPtr, n,\n                                                   mean, stddev)\n    check_status(status)\n\n\n_curand.curandGeneratePoisson.argtypes = (Generator, _P, _S, _D)\n\n\ndef generatePoisson(generator, outputPtr, n, lam):\n    status = _curand.curandGeneratePoisson(generator, outputPtr, n, lam)\n    check_status(status)\n", "path": "cupy/cuda/curand.py"}], "after_files": [{"content": "\"\"\"Thin wrapper of cuRAND.\"\"\"\nimport ctypes\nimport sys\n\nfrom cupy.cuda import internal\nfrom cupy.cuda import runtime\n\nif 'win32' == sys.platform:\n    _curand = internal.load_library(\n        internal.get_windows_cuda_library_names('curand'))\nelse:\n    _curand = internal.load_library('curand')\n\n_I = ctypes.c_int\n_U = ctypes.c_uint\n_S = ctypes.c_size_t\n_ULL = ctypes.c_ulonglong\n_P = ctypes.c_void_p\n_IP = ctypes.POINTER(_I)\n_UP = ctypes.POINTER(_U)\n_ULLP = ctypes.POINTER(_ULL)\n_F = ctypes.c_float\n_D = ctypes.c_double\n_FP = ctypes.POINTER(_F)\n_DP = ctypes.POINTER(_D)\n\nCURAND_RNG_PSEUDO_DEFAULT = 100\nCURAND_RNG_PSEUDO_XORWOW = 101\nCURAND_RNG_PSEUDO_MRG32K3A = 121\nCURAND_RNG_PSEUDO_MTGP32 = 141\nCURAND_RNG_PSEUDO_MT19937 = 142\nCURAND_RNG_PSEUDO_PHILOX4_32_10 = 161\nCURAND_RNG_QUASI_DEFAULT = 200\nCURAND_RNG_QUASI_SOBOL32 = 201\nCURAND_RNG_QUASI_SCRAMBLED_SOBOL32 = 202\nCURAND_RNG_QUASI_SOBOL64 = 203\nCURAND_RNG_QUASI_SCRAMBLED_SOBOL64 = 204\n\nCURAND_ORDERING_PSEUDO_BEST = 100\nCURAND_ORDERING_PSEUDO_DEFAULT = 101\nCURAND_ORDERING_PSEUDO_SEEDED = 102\nCURAND_ORDERING_QUASI_DEFAULT = 201\n\nGenerator = _P\nDistribution = _DP\n\nDiscreteDistribution = _P\n\n###############################################################################\n# Error handling\n###############################################################################\n\nSTATUS = {\n    0: 'CURAND_STATUS_SUCCESS',\n    100: 'CURAND_STATUS_VERSION_MISMATCH',\n    101: 'CURAND_STATUS_NOT_INITIALIZED',\n    102: 'CURAND_STATUS_ALLOCATION_FAILED',\n    103: 'CURAND_STATUS_TYPE_ERROR',\n    104: 'CURAND_STATUS_OUT_OF_RANGE',\n    105: 'CURAND_STATUS_LENGTH_NOT_MULTIPLE',\n    106: 'CURAND_STATUS_DOUBLE_PRECISION_REQUIRED',\n    201: 'CURAND_STATUS_LAUNCH_FAILURE',\n    202: 'CURAND_STATUS_PREEXISTING_FAILURE',\n    203: 'CURAND_STATUS_INITIALIZATION_FAILED',\n    204: 'CURAND_STATUS_ARCH_MISMATCH',\n    999: 'CURAND_STATUS_INTERNAL_ERROR',\n}\n\n\nclass CURANDError(RuntimeError):\n\n    def __init__(self, status):\n        self.status = status\n        super(CURANDError, self).__init__(STATUS[status])\n\n\ndef check_status(status):\n    if status != 0:\n        raise CURANDError(status)\n\n###############################################################################\n# Generator\n###############################################################################\n\n_curand.curandCreateGenerator.argtypes = (_P, _I)\n\n\ndef createGenerator(rng_type):\n    generator = Generator()\n    status = _curand.curandCreateGenerator(ctypes.byref(generator), rng_type)\n    check_status(status)\n    return generator\n\n\n_curand.curandDestroyGenerator.argtypes = (Generator,)\n\n\ndef destroyGenerator(generator):\n    status = _curand.curandDestroyGenerator(generator)\n    check_status(status)\n\n\n_curand.curandGetVersion.argtypes = (_IP,)\n\n\ndef getVersion():\n    version = _I()\n    status = _curand.curandGetVersion(ctypes.byref(version))\n    check_status(status)\n    return version\n\n\n_curand.curandSetStream.argtypes = (Generator, runtime.Stream)\n\n\ndef setStream(generator, stream):\n    status = _curand.curandSetStream(generator, stream)\n    check_status(status)\n\n\n_curand.curandSetPseudoRandomGeneratorSeed.argtypes = (Generator, _ULL)\n\n\ndef setPseudoRandomGeneratorSeed(generator, seed):\n    status = _curand.curandSetPseudoRandomGeneratorSeed(generator, seed)\n    check_status(status)\n\n\n_curand.curandSetGeneratorOffset.argtypes = (Generator, _ULL)\n\n\ndef setGeneratorOffset(generator, offset):\n    status = _curand.curandSetGeneratorOffset(generator, offset)\n    check_status(status)\n\n\n_curand.curandSetGeneratorOrdering.argtypes = (Generator, _I)\n\n\ndef setGeneratorOrdering(generator, order):\n    status = _curand.curandSetGeneratorOrdering(generator, order)\n    check_status(status)\n\n\n###############################################################################\n# Generation functions\n###############################################################################\n\n_curand.curandGenerate.argtypes = (Generator, _P, _S)\n\n\ndef generate(generator, outputPtr, num):\n    status = _curand.curandGenerate(generator, outputPtr, num)\n    check_status(status)\n\n\n_curand.curandGenerateLongLong.argtypes = (Generator, _P, _S)\n\n\ndef generateLongLong(generator, outputPtr, num):\n    status = _curand.curandGenerateLongLong(generator, outputPtr, num)\n    check_status(status)\n\n\n_curand.curandGenerateUniform.argtypes = (Generator, _P, _S)\n\n\ndef generateUniform(generator, outputPtr, num):\n    status = _curand.curandGenerateUniform(generator, outputPtr, num)\n    check_status(status)\n\n\n_curand.curandGenerateUniformDouble.argtypes = (Generator, _P, _S)\n\n\ndef generateUniformDouble(generator, outputPtr, num):\n    status = _curand.curandGenerateUniformDouble(generator, outputPtr, num)\n    check_status(status)\n\n\n_curand.curandGenerateNormal.argtypes = (Generator, _P, _S, _F, _F)\n\n\ndef generateNormal(generator, outputPtr, n, mean, stddev):\n    if n % 2 == 1:\n        msg = 'curandGenerateNormal can only generate even number of '\\\n              'random variables simultaneously. See issue #390 for detail.'\n        raise ValueError(msg)\n    status = _curand.curandGenerateNormal(generator, outputPtr, n, mean,\n                                          stddev)\n    check_status(status)\n\n\n_curand.curandGenerateNormalDouble.argtypes = (Generator, _P, _S, _D, _D)\n\n\ndef generateNormalDouble(generator, outputPtr, n, mean, stddev):\n    if n % 2 == 1:\n        msg = 'curandGenerateNormalDouble can only generate even number of '\\\n              'random variables simultaneously. See issue #390 for detail.'\n        raise ValueError(msg)\n    status = _curand.curandGenerateNormalDouble(generator, outputPtr, n, mean,\n                                                stddev)\n    check_status(status)\n\n\n_curand.curandGenerateLogNormal.argtypes = (Generator, _P, _S, _F, _F)\n\n\ndef generateLogNormal(generator, outputPtr, n, mean, stddev):\n    status = _curand.curandGenerateLogNormal(generator, outputPtr, n,\n                                             mean, stddev)\n    check_status(status)\n\n\n_curand.curandGenerateLogNormalDouble.argtypes = (Generator, _P, _S, _D, _D)\n\n\ndef generateLogNormalDouble(generator, outputPtr, n, mean, stddev):\n    status = _curand.curandGenerateLogNormalDouble(generator, outputPtr, n,\n                                                   mean, stddev)\n    check_status(status)\n\n\n_curand.curandGeneratePoisson.argtypes = (Generator, _P, _S, _D)\n\n\ndef generatePoisson(generator, outputPtr, n, lam):\n    status = _curand.curandGeneratePoisson(generator, outputPtr, n, lam)\n    check_status(status)\n", "path": "cupy/cuda/curand.py"}]}