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

Function generators return constant function if seed provided #1039

Open
frenchy64 opened this issue Apr 16, 2024 · 0 comments
Open

Function generators return constant function if seed provided #1039

frenchy64 opened this issue Apr 16, 2024 · 0 comments

Comments

@frenchy64
Copy link
Collaborator

frenchy64 commented Apr 16, 2024

This is because we use mg/generate to generate the return value, which always returns the same thing with the same seed.

(repeatedly 10 (mg/generate [:=> :cat :int]))
;=> (-480372 -103 7423 229 83 7937941 -4610 24 -1 21924979)
(repeatedly 10 (mg/generate [:=> :cat :int] {:seed 0}))
;=> (1784201 1784201 1784201 1784201 1784201 1784201 1784201 1784201 1784201 1784201)

;; even for different inputs
(mapv (mg/generate [:=> [:cat :int] :int] {:seed 0}) (range 10))
;=> [1784201 1784201 1784201 1784201 1784201 1784201 1784201 1784201 1784201 1784201]
@frenchy64 frenchy64 changed the title Function generators always return same value if seed provided Function generators return constant function if seed provided Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant