npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

randomcontentgenerator

v0.3.6

Published

Generate random content based on a schema

Downloads

8

Readme

Random Content Generator (RCG)

Simple but customizable random content generator. From simple and basic random content to advanced and complex.
RCG gives you full control on how you want your content to be generated.

NOTE:

With the 0.3 update, the Docs are currently outdated.
Please be patient while I update the docs.

See it in action

Test the library on code sandbox

Usage

Install the package on NPM
npm i randomcontentgenerator

Create a schema to tell RCG how to generate the content. Here's an example of a very basic schema.

    {
        "fields":{
            "projectTopic": ["Cooking", "Travel", "Job Search"],
            "type": ["Microservice", "Website", "Backend server"],
            "Language": ["Typescript", "C#", "Python"]
        }
    }

The generator will pick one of each at random and generate a random result, for example:

    { "projectTopic": "Travel", "Type": "Website", "Language": "C#" }

In your code define a new ContentGenerator and pass the schema in the constructor. Calling the build() method will return the result as a string in JSON format.

    let generator = new ContentGenerator(schema);
    let json = generator.build();

The schema above is simple and often not enough. Here we have an example of more advanced schema.

{
	"fields": {
		"CreatureName": [
			"@g{0} Dragon",
			"@g{0} Troll"
		],
		"Attack": {
			"min": 5,
			"max": 11
		},
		"Health": {
			"min": 100,
			"max": 500
		},
		"Description": {
			"options": [
				[
					"Increased @{0}% move speed while hidden. ",
					"Deal bonus @{1} @g{0} damage while attacking. "
				],
				[
					"While moving has increased resistance.",
					"Immune to @g{0} damage."
				]
			],
			"properties": [
				{
					"min": 5,
					"max": 11
				},
				{
					"min": 100,
					"max": 251
				}
			]
		}
	},
	"globalProperties": [
		[
			"Fire",
			"Frost",
			"Earth"
		]
	]
}

This may seems like a lot but actually really simple when you take 5 minutes to understand it. More information is found at the wiki section.

Docs

We offer full documentation over everything in the library to make using and contributing to the library easy.
You can access the docs in the wiki section where we explain how to use the library to its full potential and explaining how each system work.

Contributing

Everyone is welcome to help in any way possible (even minor).
If you modify the code, we do have a simple style guide to follow which can be found in the contributing section.
If you make a pull request that modifies the code you must request a pull request into the development branch first.

Work In Progress

This is a very early version of the package and may contain bugs and heavy changes in the future. use at your own risk.