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

Use everywhere random instead of Math.random #34

Closed
iamandrewluca opened this issue Jan 13, 2022 · 1 comment
Closed

Use everywhere random instead of Math.random #34

iamandrewluca opened this issue Jan 13, 2022 · 1 comment

Comments

@iamandrewluca
Copy link
Contributor

Is this a regression?

Yes

Description

Usage of Math.random should be banned because cannot be deterministic.
And in cases when using a faker funtion in a test, it will allways fail, because everytime returns nondeterministic random data.

A random method already exists in the source code that allow also to set a seed for pseudo random generator.

To replace every instance of Math.random with random from random.ts

+import { random } from './random.ts
-Math.random()
+random()

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

No response

Anything else?

No response

Do you want to create a pull request?

No

@NetanelBasal
Copy link
Member

I'll fix it. I didn't release it yet. This will be a part of a new major version with many changes, features, and optimizations.

@iamandrewluca I've added a lot of TODO - generate programmatically if you want to help.

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

No branches or pull requests

2 participants