randata
Randomly generate data and export it to various formats (csv, jsonl). Useful for populating databases, testing algorithms, and generating massive mock datasets on the fly.
π Features
- Blazing Fast: Written in Go, it generates thousands of records in milliseconds.
- Multiple Formats: Export directly to CSV or JSON Lines (JSONL).
- Customizable Fields: Use predefined types (names, addresses, emails) or build your own custom formats using wildcards.
- Append Mode: Continuously append new data to existing files seamlessly.
π¦ Installation
Download Binaries
You can download the pre-compiled binaries for your OS (Windows, macOS, Linux) directly from the Releases page.
Using go install
If you have Go installed:
go install github.com/BenjaminGuzman/randata@latest
π» Usage
randata [flags]
Options
| Flag |
Description |
Default |
--count |
Number of random records (rows) to generate. |
100 |
--format |
Output format (csv, jsonl). Inferred from extension if empty. |
Inferred |
--out |
Output file path. |
data.csv |
--mode |
How to update the output file (overwrite, append). |
overwrite |
--fields |
Comma separated fields to project. |
ALL |
--version |
Prints the current version. |
|
Custom Fields
If you need a field that is not one of the pre-defined ones, provide its name followed by its format separated by a colon, e.g. customField:### ??**.
Available wildcards:
?: Random letter
#: Random digit
*: Random ASCII char (between 32 space and 126 tilde)
Check the full list of pre-defined columns in generator.go.
π‘ Examples
Generate a CSV with 1,000 records containing a last name, password, 5-digit zip code, and a custom sample field:
randata --out data.csv --count 1000 --fields "lastName,password,zip:#####,sample:letter? ascii* number#"
Generated output (data.csv):
lastName,password,zip,sample
Reilly,{dkfndo{gbmhd|,89329,letterq asciiK number9
Ruecker,bd}rnv|vv,39090,letterk asciiU number5
McClure,fshy{kor,09436,letterc ascii< number1
Weimann,ejelxlauly,51831,lettera ascii0 number8
Murazik,b~ftnbiqk{xkjbxu,73276,lettero asciio number9
π οΈ Development
We use make to automate common tasks:
make build: Compile the binary.
make test: Run unit tests with coverage.
make lint: Run golangci-lint.
π License
