crandom
所属分类:其他
开发工具:TypeScript
文件大小:0KB
下载次数:0
上传日期:2023-06-23 14:05:40
上 传 者:
sh-1993
说明: 利用循环方程调整概率分布的随机数发生器
(A random number generator using circular equations to adjust probability distribution)
文件列表:
.eslintrc (299, 2023-06-23)
CODE_OF_CONDUCT.md (5220, 2023-06-23)
CONTRIBUTING.md (1163, 2023-06-23)
LICENSE (1069, 2023-06-23)
SECURITY.md (310, 2023-06-23)
dist/ (0, 2023-06-23)
dist/crandom.d.ts (1551, 2023-06-23)
dist/crandom.js (3274, 2023-06-23)
dist/test/ (0, 2023-06-23)
dist/test/crandom.test.d.ts (16, 2023-06-23)
dist/test/crandom.test.js (1231, 2023-06-23)
package.json (819, 2023-06-23)
src/ (0, 2023-06-23)
src/crandom.ts (3542, 2023-06-23)
src/test/ (0, 2023-06-23)
src/test/crandom.test.ts (1211, 2023-06-23)
tsconfig.json (11007, 2023-06-23)
# crandom
A simple random number generator based on circular equations.
Difficulty is adjustable by changing the power of the equation.
Since the equation used for generating number ranges is a circular equation, the minimum possible difficulty is -2 (negative 2). `-2` is the linear difficulty since it creates a line instead of a circle in the coordinate plane.
# Usage
## Importing
### **with Typescript**
```ts
import crandom from 'crandom';
```
### **with Vanilla Javascript**
```js
const { default: crandom } = require('crandom');
```
## Generating
Generate a random number between `1` and `5` with difficulty `3`:
```ts
const num = crandom.rand(1, 5);
num // 4
```
Generate a random number between `0` and `100` with difficulty `5`:
```ts
const num = crandom.rand(0, 100, 5);
num // 9
```
近期下载者:
相关文件:
收藏者: