Numpy random gen how to?

trying to replicate this in blender and it does not work !

rng = np.random.default_rng()

z10 = rng.random(3)
print ()
print ( ‘rng = np.random.default_rng()’ )
print ( 'z10 = ’ , z10 )
print ()

get error on the rng var ?

thanks for any feedback
happy bl

This has nothing to do with Blender. Watch your quotes for the strings! You used the wrong character (and Blender editor syntax highlighting shows that clearly). Also the Python error messages tell you where to check.

This one works fine:

rng = np.random.default_rng()

z10 = rng.random(3)
print ()
print ( 'rng = np.random.default_rng()' )
print ( 'z10 = ' , z10 )

Actually, even the code highlighting here in the forum shows it nicely. Compare the code below (yours) with the one above (correct one):

ng = np.random.default_rng()

z10 = rng.random(3)
print ()
print ( ‘rng = np.random.default_rng()’ )
print ( 'z10 = ’ , z10 )

replace my old code with the new one
and still get error on this line

rng = np.random.default_rng()

AttributeError: module ‘numpy.random’ has no attribute ‘default_rng’
Error: Python script fail, look in the console for now…

is there some other module to be uploaded may be ?

by the way i simply copied that code form a site
so did not type it myself !

thanks

happy bl

found the error

forgot to mention - i was testing it in 2.79

that random module is not included in 2.79
there was a random module in 2.79 but not whit this random function i think

but it does work in BL 3.6

thanks
happy bl