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

your-rand-int

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

your-rand-int

your-rand-int

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

your-rand-int

npm i your-rand-int

randInt(min, max)

  • min <number> 最小值
  • max <number> 最大值
  • return <number> 随机值

获取指定范围的随机整数

import randInt from 'your-rand-int'

// 正常传入 [10, 20]
randInt(10, 20)

// 支持负数 [-10, 20]
randInt(-10, 20)

// 从大到小 [20, 30]
randInt(30, 20)

// 带小数和字符串的参数,会自动转为整数 [-1, 3]
randInt(3.1, '-1.2')

FAQs

Package last updated on 03 Feb 2018

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