Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simply-random

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simply-random

```bash npm i ```

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Simple Random Functions For JS

npm i 
const Rn = require('Rn.js');

/* get random integer */
let myInt = Rn.int(0, 100); // random integer in range from 1 to 100

/* get random float */
let myFloat = Rn.float(1.01, 100); // random floating point number between 1.01 and 100


/* get random string */
let myStr = Rn.str(8, 'abc'); // random 8-char-long string containing only "a", "b", "c"


/* get random item from an array */
let weather = ['rainy', 'snowy', 'sunny'];

let todayWeather = Rn.choice(weather); // rainy | snowy | sunny


/* shuffle an array */
let cards = ['queen', 'king', 'ace'];

let shuffledCards = Rn.shuffle(cards); // random variation of items placed


console.log(myInt, myFloat, myStr, todayWeather, shuffledCards);

FAQs

Package last updated on 09 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc