{"id":20504265,"url":"https://github.com/litingyes/randomall","last_synced_at":"2026-06-10T16:31:21.579Z","repository":{"id":57700064,"uuid":"502070185","full_name":"litingyes/randomall","owner":"litingyes","description":"simple and elegant generation of random data","archived":false,"fork":false,"pushed_at":"2023-05-25T16:25:14.000Z","size":99,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-11T05:37:27.976Z","etag":null,"topics":["array","boolean","number","random","random-generation","string"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/litingyes.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-06-10T14:19:05.000Z","updated_at":"2023-03-07T04:02:48.000Z","dependencies_parsed_at":"2024-04-05T14:29:21.301Z","dependency_job_id":"e387ba29-4205-4f05-be73-ea170c7bea47","html_url":"https://github.com/litingyes/randomall","commit_stats":null,"previous_names":["litingyes/randomall","liting-yes/randomall"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/litingyes/randomall","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litingyes%2Frandomall","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litingyes%2Frandomall/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litingyes%2Frandomall/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litingyes%2Frandomall/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/litingyes","download_url":"https://codeload.github.com/litingyes/randomall/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litingyes%2Frandomall/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34161283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["array","boolean","number","random","random-generation","string"],"created_at":"2024-11-15T19:37:08.764Z","updated_at":"2026-06-10T16:31:21.560Z","avatar_url":"https://github.com/litingyes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# randomall\r\n\r\nSimple and elegant generation of random data.\r\n\r\n## Installtion\r\n\r\n```sh\r\nnpm i @liting-yes/randomall\r\n```\r\n\r\n## Hello Random\r\n\r\n```js\r\nconst random = require('@liting-yes/randomall')\r\n```\r\n\r\n### random number\r\n\r\n#### simple to use\r\n\r\n```js\r\nrandom.number()\r\n// output: 88\r\n// return an integer between [0, 100)\r\n\r\nrandom.number.DEFAULT\r\n// default parameter value\r\n```\r\n\r\n#### use with args\r\n\r\nFunction random.number has 5 params as follows:\r\n\r\n- **min** *number*\r\n\r\n\u003e mininum random number isn't less than it\r\n\r\n- **max** *number*\r\n\r\n\u003e maxinum random number doesn't exceed it\r\n\r\n- **radix** *number*\r\n\r\n\u003e base of return value (2-36)\r\n\u003e\r\n\u003e **notice**: when radix != 10, the return value will be the string value of the corresponding random number\r\n\r\n- **isInteger** *boolean*\r\n\r\n\u003e whether the return value is integer\r\n\r\n- **decimal** *number*\r\n\r\n\u003e max number of decimal places returned\r\n\r\n```js\r\nrandom.number(1, 10, 10, false, 5)\r\n// output: 1.58\r\n// return a float between [1, 10) with no more than 5 decimal places\r\n\r\n\r\n// support object passing\r\nrandom.number({ isInteger: false })\r\n// output: 62.664065\r\n```\r\n\r\n### random string\r\n\r\n#### simple to use\r\n\r\n```js\r\nrandom.string()\r\n// output: Z1Qdvk\r\n// return a random string whose characters are letters and numbers\r\n\r\nrandom.string.DEFAULT\r\nrandom.string.CHARACTAR\r\n// default parameter value\r\n```\r\n\r\n#### use with args\r\n\r\nFunction random.stringhas 6 params as follows:\r\n\r\n- **len** *number*\r\n\r\n  \u003e length of random string\r\n\r\n- **banNum** *number*\r\n\r\n  \u003e random string without numbers*\r\n\r\n- **banLowercase** *boolean*\r\n\r\n  \u003e random string without lowercase letters\r\n\r\n- **banUppercase** *boolean*\r\n\r\n  \u003e random string without uppercase letters*\r\n\r\n- **add** *array*\r\n\r\n  \u003e special characters that random string contains\r\n\r\n- **remove** *array*\r\n\r\n  \u003e special characters that random string must never contain\r\n\r\n```js\r\nrandom.string(10, true, false, true, ['@', '#', '?'], ['a', 'b', 'c'])\r\n// output: #sr#u?ljsv\r\n// return a random string that contain possibly the characters '@', '#', '? ' and no digits, uppercase letters, 'a', 'b', 'c'\r\n\r\n\r\n// support object passing\r\nrandom.string({ banNum: true, banLowercase: true })\r\n// output: ODMZPO\r\n```\r\n\r\n### random boolean\r\n\r\n#### simple to use\r\n\r\n```\r\nrandom.boolean()\r\n// output: true\r\n// return a random boolean value\r\n```\r\n\r\n### random array\r\n\r\n#### simple to use\r\n\r\n```js\r\nrandom.array()\r\n// output: [45, 71,  8, 20, 79, 17, 73, 16, 85, 44]\r\n// return an array of length 10 and each element has a value greater than 0 and less than 100\r\n```\r\n\r\n#### use with args\r\n\r\n- **len** *number*\r\n\r\n  \u003e length of random array\r\n\r\n- **fn** *function* \r\n\r\n  \u003e the function to generate random value\r\n\r\n- **args** *remain parameters*\r\n\r\n  \u003e function arguments of fn\r\n\r\n```js\r\nrandom.array(5, random.number, 1, 10)\r\n// output: [ 9, 5, 2, 5, 5 ]\r\n// return an array with 5 number element which is greater than 1 less than 10\r\n```\r\n\r\n### random image\r\n\r\n#### simple to use\r\n\r\n```js\r\nrandom.image().then(imgUrl =\u003e console.log(imgUrl))\r\n// returns a configurable random image address\r\n\r\nrandom.image.DEFAULT_CONFIG\r\nrandom.image.DEFAULT_LOCATION\r\n// default parameter value\r\n```\r\n\r\n#### use with args\r\n\r\n- **userConfig** *object*\r\n\r\n\u003e same as axios request configuration\r\n\r\n- **userLocation** *array*\r\n\r\n\u003e nested position of target data\r\n\r\n```js\r\nrandom.image({ baseURL:'https://api.ixiaowai.cn', url: '/mcapi/mcapi.php' }, ['imgurl']).then(imgUrl =\u003e console.log(imgUrl))\r\n// return an random image url about the api\r\n```\r\n\r\n#### statement\r\n\r\nthe image API the repo is using is [小歪API](https://api.ixiaowai.cn/)\r\n\r\n**in order to avoid some unforeseen problems, it is recommended to configure the API yourself**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitingyes%2Frandomall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flitingyes%2Frandomall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitingyes%2Frandomall/lists"}