Skip to content

dtype keyword for np.random.randint and np.random.rand #6790

@sebix

Description

@sebix

As brought up at the mailinglist, this code ates up much memory:

spectrumArray = np.random.randint(0,255, (2**20,2**12)).astype(np.uint8)

It has also crossed my mind that np.random.randint and np.random.rand could use an extra 'dtype' keyword. It didn't look easy to implement though.

See this thread on the mailinglist: [Numpy-discussion] array of random numbers fails to construct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions