{"id":15722642,"url":"https://github.com/indiesoftby/defold-splitmix64","last_synced_at":"2025-05-13T04:42:26.518Z","repository":{"id":46791849,"uuid":"334878840","full_name":"indiesoftby/defold-splitmix64","owner":"indiesoftby","description":"SplitMix64 PRNG for Defold: get the same random numbers from the same seeds on all platforms supported by Defold.","archived":false,"fork":false,"pushed_at":"2021-09-25T15:46:00.000Z","size":2865,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-20T22:32:47.066Z","etag":null,"topics":["defold","defold-game-engine","defold-library","defold-native-extension","lua","math","random","splitmix64"],"latest_commit_sha":null,"homepage":"https://indiesoftby.github.io/defold-splitmix64/index.html","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indiesoftby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-01T08:22:19.000Z","updated_at":"2024-07-23T20:28:46.000Z","dependencies_parsed_at":"2022-09-24T17:58:17.531Z","dependency_job_id":null,"html_url":"https://github.com/indiesoftby/defold-splitmix64","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiesoftby%2Fdefold-splitmix64","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiesoftby%2Fdefold-splitmix64/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiesoftby%2Fdefold-splitmix64/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiesoftby%2Fdefold-splitmix64/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indiesoftby","download_url":"https://codeload.github.com/indiesoftby/defold-splitmix64/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253877396,"owners_count":21977635,"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":["defold","defold-game-engine","defold-library","defold-native-extension","lua","math","random","splitmix64"],"created_at":"2024-10-03T22:08:44.916Z","updated_at":"2025-05-13T04:42:26.500Z","avatar_url":"https://github.com/indiesoftby.png","language":"C++","readme":"[![SplixMix64 Logo](cover.png)](https://github.com/indiesoftby/defold-splitmix64)\n\n# SplitMix64 PRNG for Defold\n\nThis extension wraps SplitMix64 in a simple Lua API for the [Defold](https://defold.com/) game engine. The SplitMix64 algo is from [http://prng.di.unimi.it/splitmix64.c](http://prng.di.unimi.it/splitmix64.c), and it's a very fast generator passing BigCrush.\n\n**The main idea of this extension is to get the same random numbers from the same seeds on ALL platforms supported by Defold.**\n\nTake a look at [**the web build 🐲**](https://indiesoftby.github.io/defold-splitmix64/index.html) of the included example, which tests random values from the same seeds.\n\n\u003e Splitmix64 is the default pseudo-random number generator algorithm in Java and is included / available in many other languages. It uses a fairly simple algorithm that, though it is considered to be poor for cryptographic purposes, is **very fast to calculate**, and is **\"good enough\" for many random number needs**. It passes several fairly rigorous PRNG \"fitness\" tests that some more complex algorithms fail.\n\n## Installation\n\nYou can use it in your own project by adding this project as a [Defold library dependency](http://www.defold.com/manuals/libraries/). Open your `game.project` file and in the dependencies field under project add:\n\nhttps://github.com/indiesoftby/defold-splitmix64/archive/main.zip\n\nOr point to the ZIP file of a [specific release](https://github.com/indiesoftby/defold-splitmix64/releases).\n\n## Usage\n\n### splitmix64.randomseed(x)\nSets `x` as the \"seed\" for the pseudo-random generator: equal seeds produce equal sequences of numbers.\n\n_PARAMETERS_\n* __x__ \u003ckbd\u003enumber\u003c/kbd\u003e.\n\n### splitmix64.random([m],[n])\nWhen called without arguments, returns a uniform pseudo-random real number in the range `[0,1)`. When called with an integer number `m`, `splitmix64.random` returns a uniform pseudo-random integer in the range `[1, m]`. When called with two integer numbers `m` and `n`, `splitmix64.random` returns a uniform pseudo-random integer in the range `[m, n]`.\n\n_PARAMETERS_\n* __m__ \u003ckbd\u003enumber\u003c/kbd\u003e.\n* __n__ \u003ckbd\u003enumber\u003c/kbd\u003e.\n\n_RETURNS_\n* __value__ \u003ckbd\u003enumber\u003c/kbd\u003e - A pseudo-random number.\n\n### Example\n\n```lua\nsplitmix64.randomseed(1)\n\nprint(splitmix64.random())\nprint(splitmix64.random(1, 10000))\n```\n\n### Advanced Usage\n\nYou can also globally substitute the built-in `math.random` with `splitmix64`:\n\n```\nmath.randomseed = splitmix64.randomseed\nmath.random = splitmix64.random\n```\n","funding_links":[],"categories":["Libraries"],"sub_categories":["Programming Language"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findiesoftby%2Fdefold-splitmix64","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findiesoftby%2Fdefold-splitmix64","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findiesoftby%2Fdefold-splitmix64/lists"}