Generate — Universal Data Generator
A versatile CLI tool for generating random data of various types. Produce text, numbers, UUIDs, dates, names, emails, addresses, and structured formats like JSON and CSV for testing and development.
Prerequisites
- - Python 3.8+
- INLINECODE0 shell
- Write access to INLINECODE1
Data Storage
Generated data history is stored in JSONL format at ~/.generate/data.jsonl. Each generation event is logged for reproducibility and batch export.
Commands
Run commands via: INLINECODE3
text
Generate random text strings: lorem ipsum, sentences, paragraphs, or custom patterns.
CODEBLOCK0
Arguments:
- -
--type — Text type: lorem, sentence, paragraph, word (optional, default: lorem) - INLINECODE10 — Number of words for lorem (optional, default: 20)
- INLINECODE11 — Number of items to generate (optional, default: 1)
number
Generate random numbers with configurable range and format.
CODEBLOCK1
Arguments:
- -
--min — Minimum value (optional, default: 0) - INLINECODE13 — Maximum value (optional, default: 100)
- INLINECODE14 — Decimal places for float (optional, generates int if omitted)
- INLINECODE15 — How many numbers (optional, default: 1)
uuid
Generate one or more UUIDs (v4).
CODEBLOCK2
Arguments:
- -
--count — Number of UUIDs (optional, default: 1) - INLINECODE17 — Format:
full, short (8-char) (optional, default: full)
date
Generate random dates within a range.
CODEBLOCK3
Arguments:
- -
--start — Start date YYYY-MM-DD (optional, default: 2020-01-01) - INLINECODE22 — End date YYYY-MM-DD (optional, default: 2025-12-31)
- INLINECODE23 — Number of dates (optional, default: 1)
- INLINECODE24 — Date format:
iso, us, eu, unix (optional, default: iso)
name
Generate random person names.
CODEBLOCK4
Arguments:
- -
--count — Number of names (optional, default: 1) - INLINECODE31 — Gender:
male, female, any (optional, default: any) - INLINECODE36 — Include last name (optional)
email
Generate random email addresses.
CODEBLOCK5
Arguments:
- -
--count — Number of emails (optional, default: 1) - INLINECODE38 — Email domain (optional, default: random)
address
Generate random US-style addresses.
CODEBLOCK6
Arguments:
- -
--count — Number of addresses (optional, default: 1)
json
Generate random JSON objects with a specified schema.
CODEBLOCK7
Arguments:
- -
--schema — JSON schema definition (required) - INLINECODE41 — Number of objects (optional, default: 1)
csv
Generate random CSV data with headers.
CODEBLOCK8
Arguments:
- -
--columns — Column definitions (required) - INLINECODE43 — Number of rows (optional, default: 10)
- INLINECODE44 — Output file (optional, default: stdout)
password
Generate random passwords with configurable complexity.
CODEBLOCK9
Arguments:
- -
--length — Password length (optional, default: 16) - INLINECODE46 — Number of passwords (optional, default: 1)
- INLINECODE47 — Exclude special characters (optional)
batch
Run multiple generation commands in batch from a config file.
CODEBLOCK10
Arguments:
- -
--config — Batch configuration file (required)
help
Display help information and list all available commands.
CODEBLOCK11
version
Display the current tool version.
CODEBLOCK12
Examples
CODEBLOCK13
Notes
- - All generated data is logged in
~/.generate/data.jsonl for reproducibility - Use
--seed (where supported) for deterministic output - Schema types for JSON/CSV:
name, email, uuid, int:min-max, float:min-max, bool, date, INLINECODE58 - Batch mode accepts a JSON config with an array of generation commands
Powered by BytesAgain | bytesagain.com | hello@bytesagain.com
生成 — 通用数据生成器
一款用于生成各类随机数据的多功能CLI工具。可生成文本、数字、UUID、日期、姓名、邮箱、地址以及JSON和CSV等结构化格式数据,适用于测试和开发。
前置条件
- - Python 3.8+
- bash shell
- 对~/.generate/目录的写入权限
数据存储
生成的数据历史记录以JSONL格式存储在~/.generate/data.jsonl中。每次生成事件都会被记录,以确保可复现性和批量导出。
命令
通过以下方式运行命令:bash scripts/script.sh [arguments...]
text
生成随机文本字符串:lorem ipsum、句子、段落或自定义模式。
bash
bash scripts/script.sh text --type lorem --words 50
bash scripts/script.sh text --type sentence --count 5
bash scripts/script.sh text --type paragraph --count 2
参数:
- - --type — 文本类型:lorem、sentence、paragraph、word(可选,默认值:lorem)
- --words — lorem文本的单词数量(可选,默认值:20)
- --count — 生成项的数量(可选,默认值:1)
number
生成具有可配置范围和格式的随机数字。
bash
bash scripts/script.sh number --min 1 --max 100
bash scripts/script.sh number --min 0.0 --max 1.0 --decimal 4
bash scripts/script.sh number --count 10 --min 1 --max 1000
参数:
- - --min — 最小值(可选,默认值:0)
- --max — 最大值(可选,默认值:100)
- --decimal — 浮点数的小数位数(可选,省略则生成整数)
- --count — 数字数量(可选,默认值:1)
uuid
生成一个或多个UUID(v4版本)。
bash
bash scripts/script.sh uuid
bash scripts/script.sh uuid --count 5
bash scripts/script.sh uuid --format short
参数:
- - --count — UUID数量(可选,默认值:1)
- --format — 格式:full、short(8字符)(可选,默认值:full)
date
在指定范围内生成随机日期。
bash
bash scripts/script.sh date --start 2020-01-01 --end 2025-12-31
bash scripts/script.sh date --count 10 --format iso
参数:
- - --start — 开始日期 YYYY-MM-DD(可选,默认值:2020-01-01)
- --end — 结束日期 YYYY-MM-DD(可选,默认值:2025-12-31)
- --count — 日期数量(可选,默认值:1)
- --format — 日期格式:iso、us、eu、unix(可选,默认值:iso)
name
生成随机人名。
bash
bash scripts/script.sh name
bash scripts/script.sh name --count 10 --gender female
bash scripts/script.sh name --full
参数:
- - --count — 姓名数量(可选,默认值:1)
- --gender — 性别:male、female、any(可选,默认值:any)
- --full — 包含姓氏(可选)
email
生成随机邮箱地址。
bash
bash scripts/script.sh email
bash scripts/script.sh email --count 5 --domain example.com
参数:
- - --count — 邮箱数量(可选,默认值:1)
- --domain — 邮箱域名(可选,默认值:随机)
address
生成随机美式地址。
bash
bash scripts/script.sh address
bash scripts/script.sh address --count 3
参数:
- - --count — 地址数量(可选,默认值:1)
json
根据指定模式生成随机JSON对象。
bash
bash scripts/script.sh json --schema {name:name,age:int:18-65,email:email}
bash scripts/script.sh json --schema {id:uuid,score:float:0-100} --count 5
参数:
- - --schema — JSON模式定义(必填)
- --count — 对象数量(可选,默认值:1)
csv
生成带表头的随机CSV数据。
bash
bash scripts/script.sh csv --columns name,email,age --rows 20
bash scripts/script.sh csv --columns id:uuid,name:name,score:float:0-100 --rows 50 --output data.csv
参数:
- - --columns — 列定义(必填)
- --rows — 行数(可选,默认值:10)
- --output — 输出文件(可选,默认值:标准输出)
password
生成具有可配置复杂度的随机密码。
bash
bash scripts/script.sh password
bash scripts/script.sh password --length 24 --count 5
bash scripts/script.sh password --no-special --length 16
参数:
- - --length — 密码长度(可选,默认值:16)
- --count — 密码数量(可选,默认值:1)
- --no-special — 排除特殊字符(可选)
batch
从配置文件批量运行多个生成命令。
bash
bash scripts/script.sh batch --config batch.json
参数:
help
显示帮助信息并列出所有可用命令。
bash
bash scripts/script.sh help
version
显示当前工具版本。
bash
bash scripts/script.sh version
示例
bash
生成100条用户记录为CSV格式
bash scripts/script.sh csv --columns id:uuid,name:name,email:email,age:int:18-65 --rows 100 --output users.csv
创建JSON测试数据
bash scripts/script.sh json --schema {user:name,score:float:0-100} --count 20
快速生成密码
bash scripts/script.sh password --length 20 --count 10
注意事项
- - 所有生成的数据都会记录在~/.generate/data.jsonl中,以确保可复现性
- 使用--seed(在支持的情况下)可实现确定性输出
- JSON/CSV的模式类型:name、email、uuid、int:min-max、float:min-max、bool、date、string
- 批量模式接受包含生成命令数组的JSON配置文件
由BytesAgain提供技术支持 | bytesagain.com | hello@bytesagain.com