{"id":18561441,"url":"https://github.com/apostrophecms/random-words","last_synced_at":"2025-05-16T05:06:33.573Z","repository":{"id":8735498,"uuid":"10410712","full_name":"apostrophecms/random-words","owner":"apostrophecms","description":"Generate one or more common English words. Intended for use as sample text, for example generating random blog posts for testing","archived":false,"fork":false,"pushed_at":"2024-03-18T00:04:13.000Z","size":53,"stargazers_count":257,"open_issues_count":11,"forks_count":73,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-05-08T10:54:57.011Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/apostrophecms.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"publiccode":null,"codemeta":null}},"created_at":"2013-05-31T18:31:42.000Z","updated_at":"2025-04-27T19:10:14.000Z","dependencies_parsed_at":"2024-01-03T14:28:28.789Z","dependency_job_id":"3c5b63f5-ad30-4e0b-8f6a-41d2a8c69fc8","html_url":"https://github.com/apostrophecms/random-words","commit_stats":{"total_commits":38,"total_committers":12,"mean_commits":"3.1666666666666665","dds":0.7631578947368421,"last_synced_commit":"2b0163d505a26927053d00a89a1d428969756250"},"previous_names":["punkave/random-words"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Frandom-words","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Frandom-words/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Frandom-words/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Frandom-words/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apostrophecms","download_url":"https://codeload.github.com/apostrophecms/random-words/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471061,"owners_count":22076585,"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":[],"created_at":"2024-11-06T22:06:56.932Z","updated_at":"2025-05-16T05:06:33.556Z","avatar_url":"https://github.com/apostrophecms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# random-words\n\n## Generate one or more common English words\n\n`random-words` generates random words for use as sample text. We use it to generate random blog posts when testing [Apostrophe](http://apostrophecms.org).\n\nCryptographic-quality randomness is NOT the goal, as speed matters for generating sample text and security does not. As such, `Math.random()` is used in most cases.\n\nThe `seed` option can be used with the `generate` function for situations that require deterministic output. When given the same `seed` with the same input, `generate()` will yield deterministic results, in regards to both actual word selection and the number of words returned (when using `min` and `max`). The underlying implementation of this option utilizes the [seedrandom](https://www.npmjs.com/package/seedrandom) package as a replacement for `Math.random()`.\n\nThe `count` function can be used to calculate the total number of words in the word list that meet the specified minimum and maximum length criteria.\n\nInstallation:\n\n    npm install random-words\n\nExamples:\n\n```js\nimport { generate, count } from \"random-words\";\n\nconsole.log(generate());\n//output: 'army'\n\nconsole.log(generate(5));\n//output: ['army', 'beautiful', 'became', 'if', 'actually']\n\nconsole.log(generate({ minLength: 2 }));\n//output: 'hello'\n\nconsole.log(generate({ maxLength: 6 }));\n//output: 'blue'\n\nconsole.log(generate({ minLength: 5, maxLength: 5 }));\n//output : 'world'\n\nconsole.log(generate({ minLength: 11, maxLength: 10000 })); //maxLength limited to the longest possible word\n//output: 'environment'\n\nconsole.log(generate({ minLength: 10000, maxLength: 5 })); //minLength limited to the maxLength\n//output: 'short'\n\nconsole.log(generate({ min: 3, max: 10 }));\n//output: ['became', 'arrow', 'article', 'therefore']\n\nconsole.log(generate({ exactly: 2 }));\n//output: ['beside', 'between']\n\nconsole.log(generate({ min: 2, max: 3, seed: \"my-seed\" }));\n//output: ['plenty', 'pure']\n\n// this call will yield exactly the same results as the last since the same `seed` was used and the other inputs are identical\nconsole.log(generate({ min: 2, max: 3, seed: \"my-seed\" }));\n//output: ['plenty', 'pure']\n\nconsole.log(generate({ exactly: 5, join: \" \" }));\n//output: 'army beautiful became if exactly'\n\nconsole.log(generate({ exactly: 5, join: \"\" }));\n//output: 'armybeautifulbecameifexactly'\n\nconsole.log(generate({ exactly: 2, minLength: 4 }));\n//output: ['atom', 'window']\n\nconsole.log(generate({ exactly: 5, maxLength: 4 }));\n//output: ['army', 'come', 'eye', 'five', 'fur']\n\nconsole.log(generate({ exactly: 2, minLength: 3, maxLength: 3 }));\n//output: ['you, 'are']\n\nconsole.log(generate({ exactly: 3, minLength: 5, maxLength: 100000 }));\n//output: ['understanding', 'should', 'yourself']\n\nconsole.log(generate({ exactly: 5, wordsPerString: 2 }));\n//output: [ 'salt practical', 'also brief', 'country muscle', 'neighborhood beyond', 'grew pig' ]\n\nconsole.log(generate({ exactly: 5, wordsPerString: 2, separator: \"-\" }));\n//output: [ 'equator-variety', 'salt-usually', 'importance-becoming', 'stream-several', 'goes-fight' ]\n\nconsole.log(\n  generate({\n    exactly: 5,\n    wordsPerString: 2,\n    formatter: (word) =\u003e word.toUpperCase(),\n  })\n);\n//output: [ 'HAVING LOAD', 'LOST PINE', 'GAME SLOPE', 'SECRET GIANT', 'INDEED LOCATION' ]\n\nconsole.log(\n  generate({\n    exactly: 5,\n    wordsPerString: 2,\n    formatter: (word, index) =\u003e {\n      return index === 0\n        ? word.slice(0, 1).toUpperCase().concat(word.slice(1))\n        : word;\n    },\n  })\n);\n//output: [ 'Until smoke', 'Year strength', 'Pay knew', 'Fallen must', 'Chief arrow' ]\n\nconsole.log(count());\n//output: 1952\n\nconsole.log(count({ minLength: 5 }));\n//output: 1318 \n\nconsole.log(count({ maxLength: 7 }));\n//output: 1649\n\nconsole.log(count({ minLength: 5, maxLength: 7 }));\n//output: 1015\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Frandom-words","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapostrophecms%2Frandom-words","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Frandom-words/lists"}