https://github.com/tacheometry/rbxts-randomstring
Generate random strings from a list of strings/characters (for Roblox-TS).
https://github.com/tacheometry/rbxts-randomstring
lua random roblox roblox-lua roblox-ts string
Last synced: about 1 year ago
JSON representation
Generate random strings from a list of strings/characters (for Roblox-TS).
- Host: GitHub
- URL: https://github.com/tacheometry/rbxts-randomstring
- Owner: tacheometry
- License: mit
- Created: 2020-12-20T02:50:20.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-09-04T20:35:15.000Z (over 4 years ago)
- Last Synced: 2025-03-14T23:48:32.033Z (about 1 year ago)
- Topics: lua, random, roblox, roblox-lua, roblox-ts, string
- Language: Lua
- Homepage: https://www.npmjs.com/package/@rbxts/randomstring
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [@rbxts/randomstring](https://www.npmjs.com/package/@rbxts/randomstring)
Generate random strings from a list of strings/characters.
### API
```ts
randomstring(length?: number, entries?: string[], separator?: string) → string
```
`length`: How many random entries to use. Defaults to 5.
`entries`: What strings to pick randomly from. By default, this is equal to characters a-Z 0-9.
`separator`: What string to use to concatenate randomly picked `entries`. By default, this is `""`. Example: `"-"` as a separator outputs strings like `"a-Z-9-b-F"`.
### Examples
#### Matchmaking game IDs
Simply using the module with the predefined parameters
```ts
randomstring()
```
outputs sequences similar to `TqKlf`, `M4Zvn`, `u6X8F`, which could be used as identifiers for ongoing matches in your game.
#### RoVer verification code clone
You could recreate the way [RoVer](https://github.com/evaera/RoVer) hands out codes for verifying users by inputting the following parameters:
```ts
randomstring(20, , " ")
```
→ `magenta maroon yellow red pink very purple pink blue lavender red maroon maroon yellow gray dark really teal`