{"id":15704242,"url":"https://github.com/cicirello/zigguratgaussian","last_synced_at":"2025-06-24T15:32:15.729Z","repository":{"id":38291822,"uuid":"201526811","full_name":"cicirello/ZigguratGaussian","owner":"cicirello","description":"Fast Gaussian distributed pseudorandom number generation in Java via the Ziggurat algorithm","archived":false,"fork":false,"pushed_at":"2025-06-17T22:47:19.000Z","size":528,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-17T23:32:19.564Z","etag":null,"topics":["gaussian","gaussian-distribution","java","normal","normal-distribution","ziggurat","ziggurat-algorithm"],"latest_commit_sha":null,"homepage":"","language":"Java","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/cicirello.png","metadata":{"funding":{"github":"cicirello","patreon":null,"open_collective":null,"ko_fi":"cicirello","tidelift":null,"community_bridge":null,"liberapay":"cicirello","issuehunt":null,"otechie":null,"custom":null},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":".zenodo.json"}},"created_at":"2019-08-09T19:12:30.000Z","updated_at":"2025-06-17T22:47:16.000Z","dependencies_parsed_at":"2023-12-26T02:26:05.229Z","dependency_job_id":"e5cd27b6-f393-4d7d-99b0-ab0030ae0056","html_url":"https://github.com/cicirello/ZigguratGaussian","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/cicirello/ZigguratGaussian","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cicirello%2FZigguratGaussian","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cicirello%2FZigguratGaussian/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cicirello%2FZigguratGaussian/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cicirello%2FZigguratGaussian/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cicirello","download_url":"https://codeload.github.com/cicirello/ZigguratGaussian/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cicirello%2FZigguratGaussian/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261703162,"owners_count":23196907,"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":["gaussian","gaussian-distribution","java","normal","normal-distribution","ziggurat","ziggurat-algorithm"],"created_at":"2024-10-03T20:10:51.020Z","updated_at":"2025-06-24T15:32:15.692Z","avatar_url":"https://github.com/cicirello.png","language":"Java","funding_links":["https://github.com/sponsors/cicirello","https://ko-fi.com/cicirello","https://liberapay.com/cicirello"],"categories":[],"sub_categories":[],"readme":"# Ziggurat Gaussian\n\n[\u003cimg alt=\"Ziggurat Gaussian - Fast Gaussian distributed pseudorandom number generation in Java via the Ziggurat algorithm\" \n     src=\"https://raw.githubusercontent.com/cicirello/ZigguratGaussian/master/images/ziggurat-gaussian.png\" width=\"640\"\u003e](#ziggurat-gaussian)\n\nCopyright (C) 2015, 2017-2024 [Vincent A. Cicirello](https://www.cicirello.org/).\n\n| __Packages and Releases__ | [![Maven Central](https://img.shields.io/maven-central/v/org.cicirello/ziggurat.svg?label=Maven%20Central\u0026logo=apachemaven)](https://central.sonatype.com/artifact/org.cicirello/ziggurat/) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/cicirello/ZigguratGaussian?logo=GitHub)](https://github.com/cicirello/ZigguratGaussian/releases) |\n| :--- | :--- |\n| __Build Status__ | [![build](https://github.com/cicirello/ZigguratGaussian/workflows/build/badge.svg)](https://github.com/cicirello/ZigguratGaussian/actions/workflows/build.yml) [![CodeQL](https://github.com/cicirello/ZigguratGaussian/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/cicirello/ZigguratGaussian/actions/workflows/codeql-analysis.yml) |\n| __JaCoCo Test Coverage__ | [![coverage](https://raw.githubusercontent.com/cicirello/ZigguratGaussian/badges/jacoco.svg)](https://github.com/cicirello/ZigguratGaussian/actions/workflows/build.yml) [![branches coverage](https://raw.githubusercontent.com/cicirello/ZigguratGaussian/badges/branches.svg)](https://github.com/cicirello/ZigguratGaussian/actions/workflows/build.yml)  |\n| __Security__ | [![Snyk security score](https://snyk-widget.herokuapp.com/badge/mvn/org.cicirello/ziggurat/badge.svg)](https://snyk.io/vuln/maven%3Aorg.cicirello%3Aziggurat) [![Snyk Known Vulnerabilities](https://snyk.io/test/github/cicirello/ZigguratGaussian/badge.svg)](https://snyk.io/test/github/cicirello/ZigguratGaussian) |\n| __DOI__ | [![DOI](https://zenodo.org/badge/201526811.svg)](https://zenodo.org/badge/latestdoi/201526811) |\n| __Other Information__ | [![GitHub](https://img.shields.io/github/license/cicirello/ZigguratGaussian)](https://github.com/cicirello/ZigguratGaussian/blob/master/LICENSE) [![style](https://img.shields.io/badge/style-Google%20Java%20Style-informational)](https://google.github.io/styleguide/javaguide.html) |\n| __Support__ | [![GitHub Sponsors](https://img.shields.io/badge/sponsor-30363D?logo=GitHub-Sponsors\u0026logoColor=#EA4AAA)](https://github.com/sponsors/cicirello) [![Liberapay](https://img.shields.io/badge/Liberapay-F6C915?logo=liberapay\u0026logoColor=black)](https://liberapay.com/cicirello) [![Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?logo=ko-fi\u0026logoColor=white)](https://ko-fi.com/cicirello) |\n\n## Fast Gaussian distributed pseudorandom number generation in Java via the Ziggurat algorithm\n\nThis repository contains a Java implementation of the Ziggurat \nalgorithm for generating Gaussian distributed pseudorandom numbers.\nThe Ziggurat algorithm is significantly faster than the more commonly encountered\nPolar method, and has some other desirable statistical properties.\nThe ZigguratGaussian class is a Java port of the GNU Scientific \nLibrary's C implementation (Voss, 2005) of the Ziggurat method.\nIn porting to Java, we have made several optimizations, the details of\nwhich can be found in the source code comments, which highlights any\ndifferences between this Java implementation and the \nC implementation on which it is based.\n\nThis Java implementation originated as part of an effort to speed\nup the runtime of a parallel genetic algorithm (PGA).  The PGA in\nquestion evolved its control parameters (i.e., crossover and mutation rates,\netc) using Gaussian mutation.  The only Gaussian implementation within the\nJava API is the polar method (nextGaussian method of the Random and\nThreadLocalRandom classes, however the polar method is quite slow\nrelative to other newer available alternatives, such as the Ziggurat method.\n\n## When to Use This Library\n\nThe following table summarizes when this library will speed up Gaussian random\nnumber generation relative to Java's builtin functionality:\n\n| Java Version | Significantly Faster For  | \n| --- | --- |\n| Java 11 \u0026le; version \u0026lt; Java 17 | `Random`, `SecureRandom`, `SplittableRandom`,`ThreadLocalRandom` |\n| Java version \u0026ge; Java 17 | `Random`, `SecureRandom`, `ThreadLocalRandom` |\n\nSource code and data of experiments with Java 17 can be found in \nthe [experiment](experiment) directory. The following paper discusses \nexperiments using the library with Java 17. In Java 17, several enhancements \nto random number generation were introduced, including several new random number\ngeenrators a RandomGenerator interface, and a modified ziggurat for the new random \nnumber generators as well as for `SplittableRandom`. The other legacy generators \nstill use the slow polar method, however. This report explores how and where our \nziggurat library is still relevant in Java 17.\n\n\u003e Vincent A. Cicirello. 2024. [Fast Gaussian Distributed Pseudorandom Number Generation in Java via the Ziggurat Algorithm](https://reports.cicirello.org/24/009/). arXiv:[2405.19493](https://arxiv.org/abs/2405.19493), May 2024. doi:[10.48550/arXiv.2405.19493](https://doi.org/10.48550/arXiv.2405.19493). [[PDF]](https://reports.cicirello.org/24/009/ALG-24-009.pdf)\n\nYou can find some additional experimental data comparing the performance of a sequential\ngenetic algorithm (GA) using this implementation of the Ziggurat method for\nGaussian mutation vs using the more common polar method, as well as experimental data\nfor the same comparison but with a PGA, in the following paper:\n\n\u003e V. A. Cicirello. [Impact of Random Number Generation on Parallel Genetic Algorithms](https://www.cicirello.org/publications/cicirello2018flairs.html). *Proceedings of the Thirty-First International Florida Artificial Intelligence Research Society Conference*, pages 2-7. AAAI Press, May 2018. [[PDF]](https://www.cicirello.org/publications/cicirello-flairs2018.pdf).\n\n## Background on the Algorithm Itself\n\nSee the following articles for detailed description of the Ziggurat algorithm itself, as well as\nadditional experimental data:\n* G. Marsaglia and W. W. Tsang. [The ziggurat method for generating random variables](http://www.jstatsoft.org/v05/i08/).  *Journal of Statistical Software*. 5(1):1–7, 2000. \n* P. H. W. Leong, G. Zhang, D. Lee, W. Luk, and J. Villasenor. [A Comment on the Implementation of the Ziggurat Method](https://www.jstatsoft.org/article/view/v012i07). *Journal of Statistical Software*. 12(7):1–4, 2005. \n* J. Voss. [The Ziggurat Method for Generating Gaussian Random Numbers](http://www.seehuhn.de/pages/ziggurat). GSL: GNU Scientific Library. 2005. \n\n## See [\u0026rho;\u0026mu;](https://github.com/cicirello/rho-mu) for Expanded Functionality\n\nThe entirety of this library has been absorbed \nby [\u0026rho;\u0026mu;, a Java library of Randomization enHancements and Other Math Utilities](https://github.com/cicirello/rho-mu), which\nincludes additional enhanced random number generation, among other related functionality. However, [\u0026rho;\u0026mu;](https://rho-mu.cicirello.org/)\nrequires Java 17+, whereas this Ziggurat implementation supports Java 11+.\n\n## Versioning Scheme\n\nThe library uses [Semantic Versioning](https://semver.org/) with \nversion numbers of the form: MAJOR.MINOR.PATCH, where differences \nin MAJOR correspond to incompatible API changes, differences in MINOR \ncorrespond to introduction of backwards compatible new functionality, \nand PATCH corresponds to backwards compatible bug fixes.\n\n## Java 11+\n\nThe jars of the library, distributed via Maven Central, GitHub Packages, \nand GitHub Releases, are built with OpenJDK 17 but for a target of Java 11.   \n\n## Importing from Package Repositories\n\nPrebuilt artifacts are regularly published to Maven Central and GitHub Packages. In \nmost cases, you'll want to use Maven Central. Releases are published to GitHub \nPackages mainly as a fall-back in the unlikely scenario that Maven Central is unavailable.\n\n### Importing from Maven Central\n\nAdd this to the dependencies section of your pom.xml, replacing \nthe version number with the version that you want to use.\n\n```XML\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.cicirello\u003c/groupId\u003e\n  \u003cartifactId\u003eziggurat\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.5\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Importing from GitHub Packages\n\nIf you'd prefer to import from GitHub Packages, rather than Maven Central, \nthen: (1) add the dependency as indicated in previous section above, and (2) add \nthe following to the repositories section of your pom.xml:\n\n```XML\n\u003crepository\u003e\n  \u003cid\u003egithub\u003c/id\u003e\n  \u003cname\u003eGitHub cicirello Apache Maven Packages\u003c/name\u003e\n  \u003curl\u003ehttps://maven.pkg.github.com/cicirello/ZigguratGaussian\u003c/url\u003e\n\u003c/repository\u003e\n```\n\nNote that GitHub Packages requires authenticating to GitHub.\n\n### Downloading Jar Files\n\nIf you don't use a dependency manager that supports importing from Maven Central,\nor if you simply prefer to download manually, prebuilt jars are also attached to \neach [GitHub Release](https://github.com/cicirello/ZigguratGaussian/releases).\n\n## Build with Maven\n\nIf you want to build from the source, then execute `mvn package` at the root\nof the repository. The library should build with Java 11+.\n\nTo include generation of a code coverage report during the build,\nexecute `mvn package -Pcoverage` at the root of the repository to \nenable a Maven profile that executes JaCoCo during the test phase.\n\nTo run all static analysis tools (i.e., SpotBugs, Find Security Bugs,\nrefactor-first), execute `mvn package -Panalysis` to enable a Maven \nprofile that executes the various static analysis tools that we are \nusing. The SpotBugs html report will be found in the `target` directory, \nor you can use the SpotBugs GUI with: `mvn spotbugs:gui -Panalysis`. The \nrefactor-first report will be found in the `target/site` directory.\n\nTo run all of the above: `mvn package -P \"analysis,coverage\"`.\n\n## License\n\nThe example programs in this repository are licensed under \nthe [GNU General Public License 3.0](https://www.gnu.org/licenses/gpl-3.0.en.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcicirello%2Fzigguratgaussian","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcicirello%2Fzigguratgaussian","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcicirello%2Fzigguratgaussian/lists"}