I would jitting a function in which `np.random.default_rng`

is used as `rng`

. I don’t know how to use the related code line in this case; Is it better to use it inside the function or out of it, how to control it in the both conditions?

I have read about it in the numba doc which said that we can do it with something like `with objmode(y="float64[:]"`

, but I could not use it correctly in my code. How could I run this function by `nb.jit()`

or `nb.njit()`

?

```
import numpy as np
import numba as nb
rng = np.random.default_rng(85)
min_lim = np.load("min_lim.npy")
max_lim = np.load("max_lim.npy")
NSG = np.load("NSG.npy")
# @nb.jit("float64[:, ::1], float64[:, ::1], int32[:]")
def rand_pos(min_lim, max_lim, NSG):
# Rand_Pos = np.zeros(1, NSG.shape[0]) # for parallelization if it could
# with objmode(rand_x="float64[:]", rand_y="float64[:]", rand_z="float64[:]"):
# rng = np.random.default_rng(85)
Rand_Pos_ = []
for i, j in enumerate(NSG):
mi_0, mi_1, mi_2 = min_lim[i]
ma_0, ma_1, ma_2 = max_lim[i]
rand_pos_cell = []
for m in range(j):
rand_x = rng.uniform(mi_0, ma_0, 1)
rand_y = rng.uniform(mi_1, ma_1, 1)
rand_z = rng.uniform(mi_2, ma_2, 1)
rand_pos_cell.append([rand_x, rand_y, rand_z])
Rand_Pos_.append(rand_pos_cell)
return Rand_Pos_
new_ = rand_pos(min_lim, max_lim, NSG)
```

I would be grateful for any recommendations about how to improve the performance on this code if possible (e.g. parallelization, …). Does list appending have conflict with parallelization if it could. It must be said that I don’t know if I am asking in the right place due to my new familiarity with numba.

data: `https://drive.google.com/file/d/15igYymSlf7YCAT_9Gm9_w0Dz5EeBxNf-/view?usp=sharing`