{"id":19197871,"url":"https://github.com/flarebyte/dazzling-chance","last_synced_at":"2025-07-01T14:32:59.934Z","repository":{"id":35418238,"uuid":"39683116","full_name":"flarebyte/dazzling-chance","owner":"flarebyte","description":"Number generator based on a text input with vague random properties","archived":false,"fork":false,"pushed_at":"2015-08-05T20:47:27.000Z","size":196,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T16:17:37.708Z","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/flarebyte.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":"2015-07-25T12:04:15.000Z","updated_at":"2015-07-25T12:52:04.000Z","dependencies_parsed_at":"2022-07-08T05:59:11.719Z","dependency_job_id":null,"html_url":"https://github.com/flarebyte/dazzling-chance","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarebyte%2Fdazzling-chance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarebyte%2Fdazzling-chance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarebyte%2Fdazzling-chance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarebyte%2Fdazzling-chance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flarebyte","download_url":"https://codeload.github.com/flarebyte/dazzling-chance/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240271540,"owners_count":19774859,"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-09T12:19:01.972Z","updated_at":"2025-02-23T05:12:43.899Z","avatar_url":"https://github.com/flarebyte.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-url]][daviddm-image]\n\n\u003e Number generator based on a text input with vague random properties\n\nIn short, the generator produces random values that are predictable and can be repeated.\n\n\n## Install\n\n```sh\n$ npm install --save dazzling-chance\n```\n\n\n## Create your chance\n\nThis will create a chance object with:\n* text:  an input text used for generating the numbers in a predictable way.\n* characters: a list of characters with their mapping to a number.\n* weighting (optional): a list of weights to bend the luck a little bit. \n\n\n```js\nvar dazzlingChance = require('dazzling-chance');\n\n       var chance = dazzlingChance({\n            text: \"qwertyuopasdfghjklzxcvbnm\",\n            characters: [{\n                chars: \"0-9a-z\",\n                integer: 0\n            }],\n            weighting: [{\n                name: \"fibonacci\",\n                weights: [1, 2, 3, 5, 8, 13, 21, 2]\n            }]\n\n        });\n\n```\n\n## Create a float number between min and max\n\n```\nchance.nextFloat(0, 3))\n```\n\nOr using a weight:\n\n```\nchance.nextWeightedFloat('fibonacci', 0, 3)\n```\n\n## Create an int number between min and max\n\n```\nchance.nextInt(0, 3))\n```\n\nOr using a weight:\n\n```\nchance.nextWeightedInt('fibonacci', 0, 3))\n```\n\n## Create a boolean\n\n```\nchance.nextBool()\n```\n\nOr using a weight:\n\n```\nchance.nextWeightedBool('fibonacci')\n```\n\n\n## Create a string from a given list\n\n```\nchance.nextString(['a', 'b', 'c', 'd', 'e'])\n```\nOr using a weight:\n\n```\nchance.nextWeightedString('fibonacci', ['a', 'b', 'c', 'd', 'e'])\n```\n\n## Create a number from a given list\n\n```\nchance.nextNumber([36, 47, 3, 68, 34])\n```\nOr using a weight:\n\n```\nchance.nextWeightedNumber('fibonacci', [36, 47, 3, 68, 34]), 'A')\n```\n\n## Create the next random value\n\ntype can be: 'int', 'float', 'number', 'bool', 'string'\n\n```\nchance.next({\n            type: 'float',\n            weight: 'fibonacci',\n            min: 0,\n            max: 3\n        });\n```\n\n## Create an array of random values\n\n```\nchance.nextX(4, {\n            type: 'float',\n            min: 0,\n            max: 10\n        })\n\n```\n\n## Create a high resolution random value\n\n```\nchance.nextHighRes({\n            type: 'float',\n            minResolution: 1000,\n            min: 0,\n            max: 1000\n        })\n```\n\n## Create an array of high resolution random values\n\nEx: 10 values\n\n```\nchance.nextHighResX(10, {\n            type: 'int',\n            minResolution: 1000,\n            min: 0,\n            max: 1000\n        })\n```\n\n\n## License\n\nMIT © [Olivier Huin]()\n\n\n[npm-url]: https://npmjs.org/package/dazzling-chance\n[npm-image]: https://badge.fury.io/js/dazzling-chance.svg\n[travis-url]: https://travis-ci.org/flarebyte/dazzling-chance\n[travis-image]: https://travis-ci.org/flarebyte/dazzling-chance.svg?branch=master\n[daviddm-url]: https://david-dm.org/flarebyte/dazzling-chance.svg?theme=shields.io\n[daviddm-image]: https://david-dm.org/flarebyte/dazzling-chance\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflarebyte%2Fdazzling-chance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflarebyte%2Fdazzling-chance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflarebyte%2Fdazzling-chance/lists"}