Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@SVector rand and randn don't work with rng argument #391

Closed
tpapp opened this issue Mar 28, 2018 · 2 comments
Closed

@SVector rand and randn don't work with rng argument #391

tpapp opened this issue Mar 28, 2018 · 2 comments
Labels
feature features and feature requests

Comments

@tpapp
Copy link
Contributor

tpapp commented Mar 28, 2018

Eg

julia> @SVector randn(Base.Random.GLOBAL_RNG, 5)
ERROR: TypeError: Type: in parameter, expected Type, got MersenneTwister

I looked at the macro and realized it may be tricky to do make this work, but a performant workaround would also help.

@andyferris
Copy link
Member

True, the macros by there nature are a bit of a "hack" and it's hard to cover every use case.

IIRC you can do randn(GLOBAL_RNG, SVector{5}). We should be able to support randn(GLOBAL_RNG, Size(5)) or something along those lines.

@c42f
Copy link
Member

c42f commented Jul 31, 2019

I don't think we'll fix this with the macros; there's just no way to make the macro interface generalize to the many expressions people might want to use with it. In fact, we might eventually deprecate the macro interface entirely.

@c42f c42f closed this as completed Jul 31, 2019
@c42f c42f added the feature features and feature requests label Jul 31, 2019
@c42f c42f mentioned this issue Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature features and feature requests
Projects
None yet
Development

No branches or pull requests

3 participants