Comments (7)
Any reason you're not using seed?
https://github.com/ngneat/falso#setting-a-randomness-seed
from falso.
@NetanelBasal I don't think that fully solves this particular issue does it? It allows repeat tests to get the same values back every time, but it doesn't insure that those individual values are unique from each other in the first place. If I were to rely on seeds as a solution for this, I'd have to go through a number of seeds first to find one that returns unique values, and then use that, whereas I'm hoping randFilePath()
could return a unique path regardless of seed used.
from falso.
Can you create a small stackblitz that explains your point, please?
from falso.
The smallest explanation I have is:
import { randFilePath } from '@ngneat/falso';
const path1 = randFilePath();
const path2 = randFilePath();
path1 === path2; // This is sometimes true, should always be false
from falso.
Not sure I agree that randFilePath always should be different, randomness can be the same sometimes. However randFilePath is rather lacking in the amount of return values. There should definitely be a less than 1 in a 100 chance to get the same output.
For your particular case I would just use seed like @NetanelBasal suggested, however I do realise it's unsatisfying.
The question of uniqueness was discussed briefly in #220, but the solution there seemed rather strange imho.
from falso.
Agree with @PumpedSardines that randomness can be the same sometimes.
from falso.
OK! Whatever you guys prefer. For my use cases, the high chance of collision is a big hindrance, so I'll rely on an alternative approach ππ»
from falso.
Related Issues (20)
- core/getRandomInRange accepts Min option greater than Max option
- randUuid returns the same id multiple times with the length parameter HOT 2
- JSON files for Food and Sports not deployed HOT 1
- spec with randNumber failed randomly HOT 2
- randAvatar is not so random? HOT 1
- UUID and random dates doesnΒ΄t respect the seed HOT 4
- Make falso instantiable HOT 1
- Falso attempts to import the built-in Node.js `crypto` module in the browser HOT 1
- `randFloat({ min: 0, max: 0 })` causes stack overflow HOT 2
- Can you add a CHANGELOG.md/releases? HOT 1
- 7.0.0: Incorrect `main` value in `package.json` HOT 2
- `randFloat` with equal min/max results in `RangeError: Maximum call stack size exceeded` HOT 6
- Non-uniform distribution of `randNumber` generation HOT 2
- Invalid 'main' field in '/Users/<projectDir>/node_modules/@ngneat/falso/i18n/de/package.json' of './index.cjs.js'.
- (love) Just to tell you how great your software is HOT 2
- Why can toCollection return a non-array? HOT 2
- Locale support, any ideas when that might be released? HOT 1
- randPhoneNumber will generate invalid US phone numbers HOT 1
- Schedule of the new features (PRs and locale basic structure)? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from falso.