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

integers and randint raise TypeError if rng is not provided #97

Closed
ricardoV94 opened this issue Dec 9, 2022 · 2 comments
Closed

integers and randint raise TypeError if rng is not provided #97

ricardoV94 opened this issue Dec 9, 2022 · 2 comments
Labels
bug Something isn't working random variables

Comments

@ricardoV94
Copy link
Member

ricardoV94 commented Dec 9, 2022

We should correct these methods to create the right type of RNG if they are not provided by the user (that's what super().make_node()) would do anyway

def make_node(self, rng, *args, **kwargs):
if not isinstance(
getattr(rng, "type", None), (RandomStateType, RandomStateSharedVariable)
):
raise TypeError("`randint` is only available for `RandomStateType`s")
return super().make_node(rng, *args, **kwargs)

def make_node(self, rng, *args, **kwargs):
if not isinstance(
getattr(rng, "type", None),
(RandomGeneratorType, RandomGeneratorSharedVariable),
):
raise TypeError("`integers` is only available for `RandomGeneratorType`s")
return super().make_node(rng, *args, **kwargs)

@Dhruvanshu-Joshi
Copy link
Member

is this issue still relevant after #691 ?

@ricardoV94
Copy link
Member Author

is this issue still relevant after #691 ?

No, good catch. It's no longer relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working random variables
Projects
None yet
Development

No branches or pull requests

2 participants