Coder Social home page Coder Social logo

Comments (7)

NetanelBasal avatar NetanelBasal commented on June 14, 2024

Any reason you're not using seed?

https://github.com/ngneat/falso#setting-a-randomness-seed

from falso.

rijkvanzanten avatar rijkvanzanten commented on June 14, 2024

@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.

NetanelBasal avatar NetanelBasal commented on June 14, 2024

Can you create a small stackblitz that explains your point, please?

from falso.

rijkvanzanten avatar rijkvanzanten commented on June 14, 2024

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.

PumpedSardines avatar PumpedSardines commented on June 14, 2024

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.

NetanelBasal avatar NetanelBasal commented on June 14, 2024

Agree with @PumpedSardines that randomness can be the same sometimes.

from falso.

rijkvanzanten avatar rijkvanzanten commented on June 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.