{"id":19600668,"url":"https://github.com/lindar-open/sergent","last_synced_at":"2026-01-04T14:05:03.670Z","repository":{"id":18786339,"uuid":"51440670","full_name":"lindar-open/sergent","owner":"lindar-open","description":"SEcure Random GENeraTor java library","archived":false,"fork":false,"pushed_at":"2024-07-10T08:50:27.000Z","size":69331,"stargazers_count":3,"open_issues_count":24,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-19T07:41:26.905Z","etag":null,"topics":["generator","java","number","random","secure"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lindar-open.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}},"created_at":"2016-02-10T12:49:12.000Z","updated_at":"2024-07-17T11:52:34.000Z","dependencies_parsed_at":"2023-12-04T17:45:31.793Z","dependency_job_id":null,"html_url":"https://github.com/lindar-open/sergent","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindar-open%2Fsergent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindar-open%2Fsergent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindar-open%2Fsergent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindar-open%2Fsergent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lindar-open","download_url":"https://codeload.github.com/lindar-open/sergent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251171682,"owners_count":21547141,"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":["generator","java","number","random","secure"],"created_at":"2024-11-11T09:15:51.505Z","updated_at":"2026-01-04T14:05:03.583Z","avatar_url":"https://github.com/lindar-open.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# *SE*cure *R*andom *GEN*era*T*or Kotlin library\n\nSergent is a versatile and secure random number generation (RNG) library for Kotlin, now in its 3.0 release. This latest version has been fully ported to Kotlin and Gradle, offering a more streamlined and user-friendly experience for developers.\n\n## Features\n\n- **Security**: Sergent is built with security as a priority. By default, it uses the `NativePRNGNonBlocking` algorithm, which is cryptographically secure and efficient.\n- **Flexibility**: While the default algorithm is recommended for most use cases, Sergent allows users to specify any other algorithm supported by `SecureRandom`. This makes Sergent adaptable to a wide range of cryptographic needs.\n- **NIST Compliance**: The RNG complies with the NIST RNG test harnesses, ensuring reliable and secure random number generation.\n- **RNG Monitoring**: Sergent includes an advanced monitoring system that performs continuous CHI-Square tests. This ensures the integrity and randomness of the numbers generated, with error handling to transition the RNG into an error state if required.\n\n## Installation\n\nGradle:\n\n```kotlin\ndependencies {\n    implementation(\"com.lindar:sergent:3.0.0\")\n}\n```\n\n## Usage\n\nSergent provides a simple and intuitive interface for RNG operations. Here's a quick overview of the functionalities:\n\n### Sergent Interface\n```kotlin\ninterface RNG {\n\n    // Discards a random number of numbers from the RNG\n    fun discardNumbers()\n\n    // Returns a random integer between 0 and Int.MAX_VALUE\n    fun nextInt(): Int\n\n    // Returns a random integer between 0 and max (exclusive)\n    fun nextInt(max: Int): Int\n\n    // Returns a random integer between min (inclusive) and max (exclusive)\n    fun nextInt(min: Int, max: Int): Int\n\n    // Shuffles the list in place\n    fun \u003cT\u003e shuffleList(listToShuffle: MutableList\u003cT\u003e)\n\n    // Returns a shuffled copy of the list\n    fun \u003cT\u003e shuffledCopy(list: List\u003cT\u003e): List\u003cT\u003e\n\n    // Returns a shuffled list of all the integers between min (inclusive) and max (inclusive also)\n    fun shuffledIntArray(min: Int, max: Int): IntArray\n}\n```\n\n### Usage Example\n\n```kotlin\nimport com.lindar.sergent.SergentRNG\n// Create a new RNG instance\nval rng = SergentRNG()\n\nrng.nextInt()\n```\n\n## RNG Monitoring\n\nMonitoring functionality for RNG.\n\n* It performs a CHI-Square test in the background generating numbers from the given RNG every 500 millis.\n* If the test fails more than 3 times consecutively, the RNG will enter an error state and halt number generation.\n* This is an exceptional case and should not normally occur.\n\n\n## License\nApache License Version 2.0 (See [LICENSE](LICENSE) for details).\n\n2023 - Lindar Ltd\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flindar-open%2Fsergent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flindar-open%2Fsergent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flindar-open%2Fsergent/lists"}