{"id":20692621,"url":"https://github.com/kevingimbel/fakedata_generator","last_synced_at":"2025-04-22T17:41:45.618Z","repository":{"id":34742440,"uuid":"183218195","full_name":"KevinGimbel/fakedata_generator","owner":"KevinGimbel","description":"🦀 Rust library to generate fake data","archived":false,"fork":false,"pushed_at":"2024-05-06T07:07:48.000Z","size":1828,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-13T04:25:16.792Z","etag":null,"topics":["data-generator","fake-data","fakedata","generator","library","random","rust","test-data-generator","testing-tool"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KevinGimbel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-04-24T11:49:34.000Z","updated_at":"2024-05-06T07:08:40.000Z","dependencies_parsed_at":"2023-11-27T10:32:05.499Z","dependency_job_id":"2197c96b-a203-4523-8926-a5a084a57638","html_url":"https://github.com/KevinGimbel/fakedata_generator","commit_stats":{"total_commits":43,"total_committers":2,"mean_commits":21.5,"dds":0.2325581395348837,"last_synced_commit":"c8b65e81525fc7e05c531083dbc712cc05346485"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGimbel%2Ffakedata_generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGimbel%2Ffakedata_generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGimbel%2Ffakedata_generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGimbel%2Ffakedata_generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KevinGimbel","download_url":"https://codeload.github.com/KevinGimbel/fakedata_generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224980935,"owners_count":17402100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-generator","fake-data","fakedata","generator","library","random","rust","test-data-generator","testing-tool"],"created_at":"2024-11-16T23:23:12.206Z","updated_at":"2024-11-16T23:23:12.701Z","avatar_url":"https://github.com/KevinGimbel.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `fakedata_generator`\n\u003e A rust library to generate fake data\n\n![\"data generator for Rust\"](assets/brand/github-header.png)\n\n![Build Status](https://github.com/KevinGimbel/fakedata_generator/actions/workflows/rust.yml/badge.svg)\n![Coverage](assets/coverage/flat.svg)\n[![Crates.io](https://img.shields.io/crates/v/fakedata_generator.svg)](https://crates.io/crates/fakedata_generator)\n[![Documentation at docs.rs](https://docs.rs/fakedata_generator/badge.svg)](https://docs.rs/fakedata_generator/)\n\n## Table of contents\n\u003c!-- BEGIN mktoc --\u003e\n\n- [Table of contents](#table-of-contents)\n- [About](#about)\n- [Usage](#usage)\n- [Generators](#generators)\n  - [Generators without arguments](#generators-without-arguments)\n    - [email](#email)\n    - [username](#username)\n    - [domain](#domain)\n    - [http method](#http-method)\n    - [ipv4](#ipv4)\n    - [gen_prime](#gen_prime)\n    - [enum](#enum)\n    - [int](#int)\n    - [private ipv4](#private-ipv4)\n    - [passwords](#passwords)\n      - [Without special chars](#without-special-chars)\n      - [With special chars](#with-special-chars)\n  - [Corpora generator](#corpora-generator)\n- [Users](#users)\n- [Contributing](#contributing)\n  - [Where to start?](#where-to-start)\n  - [Tooling](#tooling)\n- [Code of Conduct](#code-of-conduct)\n- [License](#license)\n\u003c!-- END mktoc --\u003e\n\n## About\n[⬆️ Back to Top](#table-of-contents)\n\nThis library provides functions to generate random values (\"fake data\"). It is in its early stages and some values are not yet fully random. Basic documentation is provided below and on [https://docs.rs/fakedata_generator/](https://docs.rs/fakedata_generator/). \n\n## Usage\n[⬆️ Back to Top](#table-of-contents)\n\nAdd the library as dependency to your `Cargo.toml`.\n\n```\n[dependencies]\nfakedata_generator = \"0.4\"\n```\n\nNow the the library can be loaded with `use fakedata_generator::*`.    \n\n```rust\nextern crate fakedata_generator;\nuse fakedata_generator::*;\n\nfn main() {\n    let random_word = gen_enum(\"some,random,words\".to_string());\n    println!(\"Random word is: {}\", random_word); \n}\n```\n\nA full list of available generators and their function signature is shown below. \n\n## Generators\n\n### Generators without arguments\n[⬆️ Back to Top](#table-of-contents)\n\n#### email\n\nReturn a random e-Mail address which is a combination of the username and domain generator.\n\nFunction signature\n```rust\ngen_email() -\u003e String\n```\n\nExample call\n```shell\nlet email: String = gen_email();\n// email = shaneIxD@we.net\n```\n\n#### username\n\nReturn a random username.\n\n*Note:* predefined list as of `v0.2`.\n\nFunction signature\n```rust\ngen_username() -\u003e String\n```\n\nExample call\n```rust\nlet user: String = gen_username();\n// user = ahmadajmi\n```\n\n#### domain\n\nReturn a random domain name.\n\n*Note:* Does not yet support all TDLs and true random host names - it's created by a predefined list.\n\nFunction signature\n```rust\ngen_domain() -\u003e String\n```\n\nExample call\n```rust\nlet domain: String = gen_domain();\n// domain = \"names.us\"\n```\n\n#### http method\n\nReturn a random HTTP method from a defined list.\n\nPossible values: `\"DELETE\", \"GET\", \"HEAD\", \"OPTION\", \"PATCH\", \"POST\", \"PUT\"`\n\nFunction signature\n```rust\ngen_http_method() -\u003e String\n```\n\nExample call\n```rust\nlet method: String = gen_http_method();\n// method = \"GET\"\n```\n\n\n#### ipv4\n\nReturns a random IP address. Generates four numbers in the range of 0 - 255 which are written out in the format `{}.{}.{}.{}`. \n\nFunction signature\n```rust\ngen_ipv4() -\u003e String\n``` \n\nExample call\n```rust\nlet ip: String = gen_ipv4();\n// ip = \"168.11.40.75\"\n```\n\n#### gen_prime\n\nReturns one of the first 1000 prime numners, randomely.\n\nFunction signature\n```rust\ngen_prime() -\u003e usize\n``` \n\nExample call\n```rust\nlet prime: usize = gen_prime();\n// prime = 6323\n```\n### Generators with arguments\n[⬆️ Back to Top](#table-of-contents)\n\n#### enum\n\nReturn random string from set of specified strings. Specify a comma separated list as argument.\n\nFunction signature\n```rust\ngen_enum(input: String) -\u003e String\n```\n\nExample call\n```rust\nlet word: String = gen_enum(\"hello,hola,hallo\".to_string());\n// word = \"hola\"\n```\n\n\n#### int\n\nReturn random integer in range. Must specify 1 or 2 numbers separated by comma. If 1 argument is specified it is handled as \"highest\" value and `0` is used as lowest value. \n\nFunction signature\n```rust\ngen_int(input: String) -\u003e String\n```\n\nExample call\n```rust\nlet num: String = gen_enum(\"1,100\".to_string());\n// num = \"42\"\n```\n\n#### private ipv4\n\nCreates a private IPv4 address in one of these 3 ranges:\n\n- 10.0.0.0 – 10.255.255.255\n- 172.16.0.0 – 172.31.255.255\n- 192.168.0.0 – 192.168.255.255\n\nThe `input` is the number of the first block and can be `10`, `172`, or `192`. If an invalid value is specified it defaults to `10`.\n\nFunction signature\n```rust\ngen_private_ip(input: usize) -\u003e String\n```\n\nExample call\n```rust\nlet private_ipv4: String = gen_private_ipv4(10);\n// num = 10.64.197.255\n```\n\n#### passwords\n\n##### Without special chars\nCreates a random string.\n\nThe `input` is the number of characters the password should consist of.\n\nFunction signature\n```rust\ngen_password(input: usize) -\u003e String\n```\n\nExample call\n```rust\nlet pw: String = gen_password(32);\n// pw = \"bNNpAmShvQYbKbMdhByK17lqaFcgarrF\"\n```\n\n##### With special chars\nCreates a random string with special chars.\n\nThe `input` is the number of characters the password should consist of.\n\nFunction signature\n```rust\ngen_password_with_special_chars(input: usize) -\u003e String\n```\n\nExample call\n```rust\nlet pw: String = gen_password_with_special_chars(32);\n// pw = \"F=\u003e:e+KX;Uu/Zg#i*MQN//6r%a^K?K°0\"\n```\n\n### Corpora generator\n[⬆️ Back to Top](#table-of-contents)\n\n`gen_corpora_switch` is deprecated and should not be used anymore.\n\nInstead there's a new `gen_switch` function that gets its data in JSON format taken from the [Corpora Project](https://github.com/dariusk/corpora). A copy of the entire Corpora project is included in the `data` directory.\nNot all data sets are available as of now. See the [src/corpora/data.rs](https://github.com/kevingimbel/fakedata_generator/blob/master/src/corpora/data.rs) file for all available sets.\n\nPossible input values: \n- `cat`\n- `dog`\n- `horse`\n- `dinosaur`\n- `gemstone`\n- `mood`\n- `fabric`\n- `tvshow`\n\nEach of these will return a random word from the list.\n\nFunction signature\n```rust\ngen_switch(input: String) -\u003e String\n```\n\nExample call\n```rust\nlet word: String = gen_switch(\"cat\".to_string());\n// word = \"European Shorthair\"\n\nlet fabric: String = gen_switch(\"fabric\".to_string());\n// word = \"longcloth\"\n```\n\n## Users\n[⬆️ Back to Top](#table-of-contents)\n\nThe following is a list of projects using `fakedata_generator`. Want to have your project added? Open a PR! 🧡\n\n| Name | Description | Repository |\n|------|-------------|------------|\n| `fakedata_server` | A HTTP API providing random values based on `fakedata_generator` data. | [View code](https://github.com/kevingimbel/fakedata_server) |\n| `vector` | [vector](https://github.com/vectordotdev/vector) is a  high-performance observability data pipeline. They use `fakedata_generator` as part of their test setup | [View code](https://github.com/vectordotdev/vector/tree/master/lib/fakedata) |\n\n\n## Contributing\n[⬆️ Back to Top](#table-of-contents)\n\nWe love and welcome every form of contribution.\n\n### Where to start?\n\nHere are some good places to start:\n\n* Issues with label [Good first issue](https://github.com/kevingimbel/fakedata_generator/labels/good%20first%20issue)\n* Issues with label [Documentation](https://github.com/kevingimbel/fakedata_generator/labels/documentation)\n* Providing example implementations or usage demos\n\n### Tooling\n\n- [mktoc](https://github.com/KevinGimbel/mktoc) is used for table of content generation in the README.md\n- [grcov](https://github.com/mozilla/grcov) is used to generate the coverage badge\n    - this is currently done by hand and not by CI, run `helpers/coverage.sh` to update the badge\n\n## Code of Conduct\n[⬆️ Back to Top](#table-of-contents)\n\nYou are expected to follow our [code of conduct](https://github.com/kevingimbel/fakedata_generator/blob/master/CODE_OF_CONDUCT.md) when interacting with the project via issues, pull requests or in any other form. Many thanks to the awesome [contributor covenant](https://www.contributor-covenant.org/) initiative!\n\n## License\n[⬆️ Back to Top](#table-of-contents)\n\n[MIT License](https://github.com/kevingimbel/fakedata_generator/blob/master/LICENSE) Copyright (c) 2019 Kevin Gimbel\n\nSpecial Thanks to the Rust Community, Rust Language Maintainers, and JetBrains for IntelliJ IDEA. See [NOTICE](https://github.com/kevingimbel/fakedata_generator/blob/master/NOTICE) for full list. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevingimbel%2Ffakedata_generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevingimbel%2Ffakedata_generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevingimbel%2Ffakedata_generator/lists"}