New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

random-fragment

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-fragment

a gadget for generating random fragment

latest
npmnpm
Version
0.3.2
Version published
Maintainers
1
Created
Source

random-fragment

a gadget for generating random fragment

Install

npm install random-fragment
# or
yarn add random-fragment

Usage

const randomFragment = require('random-fragment');

// Get a random integer in the specified range
// The return value type is "number"
// The default range is [0,10], that is, "min" is 0, "max" is 10
randomFragment.getRandomInt();

// Get a random floating point number in the specified range
// The return value type is "string"
// The default range is [0.0,10.0], and the number of decimal places is 1,
// that is, "min" is 0, "max" is 10, "decimals" is 1
randomFragment.getRandomFloat();

// Get elements randomly from the specified array
// You need to pass in "sourceArray", which needs to be an iterative object
// The default "times" is 1, "canRepeat" is true
randomFragment.getRandomInArray({
  sourceArray: [1, 3, 5, 7, 11]
});

Keywords

random

FAQs

Package last updated on 28 Dec 2022

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