@kuankuan/assist-2026 0.1.16 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ export * from './copyText';
2
+ export * from './random';
@@ -0,0 +1,2 @@
1
+ export * from './copyText';
2
+ export * from './random';
@@ -0,0 +1,3 @@
1
+ export declare function randomFloat(min: number, max: number): number;
2
+ export declare function randomInt(min: number, max: number): number;
3
+ export declare function randomChoice<T>(arr: T[]): T;
@@ -0,0 +1,9 @@
1
+ export function randomFloat(min, max) {
2
+ return Math.random() * (max - min) + min;
3
+ }
4
+ export function randomInt(min, max) {
5
+ return Math.floor(randomFloat(min, max));
6
+ }
7
+ export function randomChoice(arr) {
8
+ return arr[randomInt(0, arr.length)];
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kuankuan/assist-2026",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "A toolset from kuankuan",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -12,4 +12,4 @@ export let copyText = (text: string) => {
12
12
  };
13
13
  }
14
14
  copyText(text);
15
- }
15
+ };
@@ -0,0 +1,2 @@
1
+ export * from './copyText';
2
+ export * from './random';
@@ -0,0 +1,9 @@
1
+ export function randomFloat(min: number, max: number) {
2
+ return Math.random() * (max - min) + min;
3
+ }
4
+ export function randomInt(min: number, max: number) {
5
+ return Math.floor(randomFloat(min, max));
6
+ }
7
+ export function randomChoice<T>(arr: T[]): T {
8
+ return arr[randomInt(0, arr.length)]!;
9
+ }
File without changes
File without changes