question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generate Random Objects!

See original GitHub issue

Hi – thanks for the great library!

It seems it would be extremely easy and useful to implement getting whole random objects – like person, web etc. It would mostly compile a set of random values for their fields.

This would be very useful for testing (suppose somebody wants randomly generated objects). A similar, albeit more advanced, idea would be to have a chance.newObject(obj) where obj is an object describing the structure of the resulting object (i.e., allowing chance to fill in the values of the template).

I would be interested to hear thoughts, and if you agree on the features I can send a pull request:)

Thanks again!

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ganqqwertycommented, Feb 27, 2018

What about generating objects by their jsonschema or typescript type or class descriptions? This would be valuable in unit tests.

1reaction
caimencommented, Nov 30, 2016

@oliversalzburg I tend to agree with you, generating random objects with so many possible different permutations and requirements would I think be an endless rabbit hole. It’s a rabbit hole I’ve been down before and there is no end in sight. Right now chance js gives you the ability to generate all sort of of data types. Users can use those data types to create there own random objects very easily. I don’t see the advantage of having the library attempt do things like that for you and in the end seems like a futile endeavor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Random Object Generator - Perchance.org
title = Random Object Generator subtitle = Simply generates a random everyday object at each click :) fontSize = 200 fontColor = black...
Read more >
Random Object Generator - The Word Finder
Generate one (or many) objects at random with our generator tool! For example:Scissors, bottle, chair, pen, etc.
Read more >
Generate a list of random things - Random Lists
Create a scavenger hunt by generating a couple lists of 10 things. Pass out those lists and race your friends to collect all...
Read more >
Random Object Generator | (1500+ Objects)
The Random Object Tool generates random object. This tool support unlimited object generation, It means you can generate multiple object at a single...
Read more >
Random Object Generator - The Story Shack
Generate thousands of random objects with this Random Object Generator ⚡️ Ideas can be saved and copied ⚡️ Fuel your creativity and start...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found