{"id":13509377,"url":"https://github.com/caioceccon/random_string_generator","last_synced_at":"2026-02-22T10:35:14.111Z","repository":{"id":57539702,"uuid":"101933324","full_name":"caioceccon/random_string_generator","owner":"caioceccon","description":"A Elixir module to generate a random string based on a given string pattern.","archived":false,"fork":false,"pushed_at":"2019-07-04T09:13:40.000Z","size":31,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-02T01:34:56.701Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caioceccon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-30T22:07:08.000Z","updated_at":"2020-08-27T21:20:34.000Z","dependencies_parsed_at":"2022-09-26T18:31:51.434Z","dependency_job_id":null,"html_url":"https://github.com/caioceccon/random_string_generator","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/caioceccon/random_string_generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caioceccon%2Frandom_string_generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caioceccon%2Frandom_string_generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caioceccon%2Frandom_string_generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caioceccon%2Frandom_string_generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caioceccon","download_url":"https://codeload.github.com/caioceccon/random_string_generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caioceccon%2Frandom_string_generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29709401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T05:59:28.568Z","status":"ssl_error","status_checked_at":"2026-02-22T05:58:46.208Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-08-01T02:01:06.914Z","updated_at":"2026-02-22T10:35:14.087Z","avatar_url":"https://github.com/caioceccon.png","language":"Elixir","funding_links":[],"categories":["Text and Numbers"],"sub_categories":[],"readme":"# RandomStringGenerator\n\n[![Build Status](https://travis-ci.org/caioceccon/random_string_generator.svg?branch=master)](https://travis-ci.org/caioceccon/random_string_generator) [![codecov](https://codecov.io/gh/caioceccon/random_string_generator/branch/master/graph/badge.svg)](https://codecov.io/gh/caioceccon/random_string_generator)\n\n**A module to generate a random string based on a given string pattern**\n\n## Installation\n\nThe package can be installed by adding `random_string_generator` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:random_string_generator, \"~\u003e 1.0.0\"}\n  ]\nend\n```\n\n## Usage\n\n#### Accepted string patterns:\n\n  Use `l` for lower case letter from a to z\n\n  Use `L` for upper case letter from A to Z\n\n  Use `d` for digit from 0 to 9\n\n  Use `p` for punctuation\n\n  Use `c` for custom character\n\n#### Punctuation is any character on the following group:\n\n  `!`, `\"`, `#`, `$`, `%`, `\u0026`, `'`, `(`, `)`, `*`, `+`, `,`, `-`,\n  `.`, `/`, `:`, `;`, `\u003c`, `=`, `\u003e`, `?`, `@`, `[`, ` \\ `, `]`, `^`,\n  `_`, `{`, `|`,`}`, `~` and `` ` ``\n\n##### Generate a string containing 2 lower case letters followed by 2 digits.\n```elixir\niex\u003e RandomStringGenerator.generate(\"lldd\")\n\"ol68\"\n```\n\n##### Generate a string containing 2 upper case letters.\n```elixir\niex\u003e RandomStringGenerator.generate(\"LL\")\n\"VR\"\n```\n\n##### Generate a string containing 2 punctuations.\n```elixir\niex\u003e RandomStringGenerator.generate(\"pp\")\n\"?!\"\n```\n\n**Delimiters**\n\n  Everything that is not `l`,`L`,`d`,`p` and `c` is treated as a delimiter so\n  the pattern `-dl?` is interpreted as a hyphen followed by a digit followed by\n  a lower case letter followed by a question mark.\n\n##### Generate a string containing 2 letters followed by a hyphen.\n```elixir\niex\u003e RandomStringGenerator.generate(\"ll-\")\n\"yz-\"\n```\n\n**Scape**\n\n  In order to generate a string containing the characters `l`,`L`,`d` and `p`\n  as a delimiter, you need to use the backslash twice in order to scape it.\n\n##### Generate a string containing 2 digits followed by the letters `lLdp`.\n```elixir\niex\u003e RandomStringGenerator.generate(\"dd\\\\l\\\\L\\\\d\\\\p\")\n\"39lLdp\"\n```\n\n**Custom Chars**\n\n  I order to generate a string based on a given custom pattern `ccc` a list\n  of possible values need to be passed as an argument.\n\n##### Generate a string containing 3 custom chars from the list `[\"+\", \"-\", \"/\", \"*\"]`.\n```elixir\niex\u003e RandomStringGenerator.generate(\"ccc\", [\"+\", \"-\", \"/\", \"*\"])\n\"+/*\"\n```\n\n  If no custom char list is passed the with character `c` it will be treated\n  as a **delimiter** as in the example below where it generates a string containing\n  one digit followed by the letter c followed by another digit\n\n```elixir\niex\u003e RandomStringGenerator.generate(\"dcd\")\n\"2c1\"\n```\n\n**Shuffling**\n\n  In order to generate a string based on a given patter `Lldd` where those\n  characters are placed in a random order, the `shuffle/1` function should\n  be used.\n\n##### Generate a string containing 2 lower case letters, 2 digits in random order.\n```elixir\niex\u003e RandomStringGenerator.generate(\"Lldd\") |\u003e RandomStringGenerator.shuffle()\n\"s22E\"\n```\n\nFull documentation at [https://hexdocs.pm/random_string_generator](https://hexdocs.pm/random_string_generator).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaioceccon%2Frandom_string_generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaioceccon%2Frandom_string_generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaioceccon%2Frandom_string_generator/lists"}