Libraries & API
Core
Core intro

@hello-worlds/core NPM version

A set of utility functions, useful mostly for seed management.

Usage

import { setRandomSeed, getSeed, random } from "@hello-worlds/core"
 
setRandomSeed("MyWorldSeed")
 
getSeed() // "MyWorldSeed"
 
const value = random() // seeded random number

Random Utilities

The core library comes with some utilities that the other make use of to generate random values.

 
capitalize() // returns a random capitalized letter
 
randomSign() // returns a random sign (-1 or 1)
 
randomRangeInt(min: number, max: number) // returns a random integer between min and max
 
randomRange(min: number, max: number) // returns a random float between min and max
 
sample<T>(array: T[]) // returns a random element from the array
 
shuffle<T>(array: T[]) // returns a shuffled copy of the array