# random-int **Repository Path**: ArkTSCentralRepository/random-int ## Basic Information - **Project Name**: random-int - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2024-11-21 - **Last Updated**: 2026-03-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # random-int > Generate a random integer 基于[random-int](https://www.npmjs.com/package/random-int)原库3.0.0版本进行适配,所有功能代码已经转换为`ArkTS`文件 ## Install ```shell ohpm install random-int ``` ## Usage ```typescript import randomInteger from 'random-int'; randomInteger(5); //=> 3 randomInteger(10, 100); //=> 54 ``` ## API ### randomInteger(maximum?) Returns an integer from `0` to `maximum`. ### randomInteger(minimum, maximum) Returns an integer from `minimum` to `maximum`. #### minimum Type: `number`\ Default: `0` Minimum integer to return. #### maximum Type: `number`\ Default: `1` Maximum integer to return. ## Related - [random-float](https://github.com/sindresorhus/random-float) - Generate a random float - [random-item](https://github.com/sindresorhus/random-item) - Get a random item from an array - [random-obj-key](https://github.com/sindresorhus/random-obj-key) - Get a random key from an object - [random-obj-prop](https://github.com/sindresorhus/random-obj-prop) - Get a random property from an object - [unique-random](https://github.com/sindresorhus/unique-random) - Generate random numbers that are consecutively unique - [unique-random-array](https://github.com/sindresorhus/unique-random-array) - Get consecutively unique elements from an array - [crypto-random-string](https://github.com/sindresorhus/crypto-random-string) - Generate a cryptographically strong random string