Quansight-Labs / numpy.net

A port of NumPy to .Net
BSD 3-Clause "New" or "Revised" License
131 stars 14 forks source link

randint does'nt work without shape #12

Closed bitstormFA closed 3 years ago

bitstormFA commented 3 years ago

First of all many thanks for your great work!

I'm using numpy.net from f# Trying to create a single element random int array with

let rand0 = np.random()
let a = rand0.randint(0L, 4242L, dtype=np.UInt32)

fails with

System.NullReferenceException : Object reference not set to an instance of an object.
   at NumpyDotNet.np.random.CountTotalElements(shape _shape)
   at NumpyDotNet.np.random._randuint32(Int64 low, Nullable`1 high, shape newdims)
   at NumpyDotNet.np.random.randint(Int64 low, Nullable`1 high, shape newshape, dtype dtype)

If I define a shape rand0.randint(1L, maxHash0, shape(1), dtype=np.UInt32) the call works properly

KevinBaselinesw commented 3 years ago

Thank you for your bug report and kind words. I was not checking the shape value for null and converting it to shape(1). I just fixed this bug. Would you prefer an immediate release with the bug fix or can you live with the workaround for a few days? If you have any other bugs, please let me know and I will try to fix them ASAP.

bitstormFA commented 3 years ago

With the workaround I'm using numpy.net very successful so no need to hurry a release. If I find anything else I will of course report it