1.0.1 • Published 2 years ago

@-silver/random-rng v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

random-rng

Random assortment of RNG-based functions. You never needed this, but now you have it.

Installing

I prefer require() but I don't care what you use.

const { ... } = require("random-rng")
import { ... } from 'random-rng'

Usage

odds

Uses a number through 1 - 99 to use as a percentage in RNG.

Example

const { odds } = require("random-rng")

if (odds(15)) { // 15% of the time
  console.log("You win!")
} else {
  console.log("You lose...")
}

gen_word

Generates a random word that may or may not be real. (we don't know)

Example

const { gen_word } = require("random-rng")

if (gen_word() == "hi") { // pretty small chance
  console.log("Hello!!")
} else {
  console.log("???????")
}

gen_sentence

Generates a random sentence with random punctuation and random words. I'm going to admit this uses gen_word.

len - Length of the sentence in words.

Example

const { gen_sentence } = require("random-rng")

// possible social app code

if (user.new) {
  user.bio = gen_sentence(8) // generates a random 8 sentence bio.
}

gen_paragraph

Generates a full-blown paragraph using gen_word and gen_sentence. This was made for fun.

min - Minimum length of a sentence in words. max - Maximum length of a sentence in words. len - The amount of sentences in the paragraph.

Example

const { gen_paragraph } = require("random-rng")

// possible showcase app here

app.box[92].content = gen_paragraph() // generates filler text for box 92.

gen_title

Generates a title for a movie, a video game, I don't know. Some combinations might be- uh... mature.

Example

const { gen_title } = require("random-rng")

// possible book creation code here

book.filler_title = gen_title() // generates a filler title that the user can change (if they want to)

Have fun.