{"id":17993941,"url":"https://github.com/jimeh/rands","last_synced_at":"2026-02-19T18:31:15.320Z","repository":{"id":45368113,"uuid":"331174574","full_name":"jimeh/rands","owner":"jimeh","description":"Go package providing a suite of functions that use crypto/rand to generate cryptographically secure random strings in various formats.","archived":false,"fork":false,"pushed_at":"2025-03-31T22:40:08.000Z","size":127,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T13:56:50.056Z","etag":null,"topics":["go","golang","random","random-generation","secure-random","secure-random-string","string","strings"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/jimeh/rands","language":"Go","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/jimeh.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-01-20T02:53:32.000Z","updated_at":"2025-03-11T00:06:06.000Z","dependencies_parsed_at":"2025-10-15T04:04:57.201Z","dependency_job_id":"56fbd4a9-8145-466f-8a4d-726947cf8661","html_url":"https://github.com/jimeh/rands","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jimeh/rands","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Frands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Frands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Frands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Frands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimeh","download_url":"https://codeload.github.com/jimeh/rands/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Frands/sbom","scorecard":{"id":520408,"data":{"date":"2025-08-11","repo":{"name":"github.com/jimeh/rands","commit":"c98b79b4c5733e3eb173d7292b854143ac3a87f1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/18 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: jobLevel 'deployments' permission set to 'write': .github/workflows/ci.yml:107","Warn: jobLevel 'contents' permission set to 'write': .github/workflows/ci.yml:108","Warn: no topLevel permission defined: .github/workflows/ci.yml:1"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:92: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:93: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:110: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:111: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:121: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:136: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/jimeh/rands/ci.yml/main?enable=pin","Info:   0 out of  12 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":3,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Info: 'force pushes' disabled on branch 'main'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'main'","Warn: 'stale review dismissal' is disabled on branch 'main'","Warn: branch 'main' does not require approvers","Warn: codeowners review is not required on branch 'main'","Warn: 'last push approval' is disabled on branch 'main'","Warn: 'up-to-date branches' is disabled on branch 'main'","Info: status check found to merge onto on branch 'main'","Info: PRs are required in order to make changes on branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":4,"reason":"SAST tool is not run on all commits -- score normalized to 4","details":["Warn: 9 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T02:54:15.381Z","repository_id":45368113,"created_at":"2025-08-20T02:54:15.382Z","updated_at":"2025-08-20T02:54:15.382Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29627111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T18:02:07.722Z","status":"ssl_error","status_checked_at":"2026-02-19T18:01:46.144Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["go","golang","random","random-generation","secure-random","secure-random-string","string","strings"],"created_at":"2024-10-29T20:13:31.910Z","updated_at":"2026-02-19T18:31:15.294Z","avatar_url":"https://github.com/jimeh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  rands\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003e\n    Go package providing a suite of functions that use \u003ccode\u003ecrypto/rand\u003c/code\u003e\n    to generate cryptographically secure random data in various forms and\n    formats.\n  \u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pkg.go.dev/github.com/jimeh/rands\"\u003e\u003cimg src=\"https://img.shields.io/badge/%E2%80%8B-reference-387b97.svg?logo=go\u0026logoColor=white\" alt=\"Go Reference\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/jimeh/rands/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/tag/jimeh/rands?label=release\" alt=\"GitHub tag (latest SemVer)\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/jimeh/rands/actions\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/jimeh/rands/ci.yml?branch=main\u0026logo=github\" alt=\"Actions Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://codeclimate.com/github/jimeh/rands\"\u003e\u003cimg src=\"https://img.shields.io/codeclimate/coverage/jimeh/rands.svg?logo=code%20climate\" alt=\"Coverage\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/jimeh/rands/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues-raw/jimeh/rands.svg?style=flat\u0026logo=github\u0026logoColor=white\" alt=\"GitHub issues\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/jimeh/rands/pulls\"\u003e\u003cimg src=\"https://img.shields.io/github/issues-pr-raw/jimeh/rands.svg?style=flat\u0026logo=github\u0026logoColor=white\" alt=\"GitHub pull requests\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/jimeh/rands/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/jimeh/rands.svg?style=flat\" alt=\"License Status\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## [`rands`](https://pkg.go.dev/github.com/jimeh/rands) package\n\n`rands` is intended for use in production code where random data generation is\nrequired. All functions have a error return value which should be checked.\n\nFor tests there is the `randsmust` package, which has all the same functions but\nwith single return values, and they panic in the event of an error.\n\n### Import\n\n```\nimport \"github.com/jimeh/rands\"\n```\n\n### Usage\n\n```go\ns, err := rands.Base64(16)       // =\u003e CYxqEdUB1Rzno3SyZu2g/g==\ns, err := rands.Base64URL(16)    // =\u003e zlqw9aFqcFggbk2asn3_aQ\ns, err := rands.Hex(16)          // =\u003e 956e2ec9e7f19ddd58bb935826926531\ns, err := rands.Alphanumeric(16) // =\u003e Fvk1PkrmG5crgOjT\ns, err := rands.Alphabetic(16)   // =\u003e XEJIzcZufHkuUmRM\ns, err := rands.Upper(16)        // =\u003e UMAGAFPPNDRGLUPZ\ns, err := rands.UpperNumeric(16) // =\u003e DF0CQS0TK9CPUO3E\ns, err := rands.Lower(16)        // =\u003e ocsmggykzrxzfwgt\ns, err := rands.LowerNumeric(16) // =\u003e rwlv7a1p7klqffs5\ns, err := rands.Numeric(16)      // =\u003e 9403373143598295\n\ns, err := rands.String(16, \"abcdefABCDEF\")                               // =\u003e adCDCaDEdeffeDeb\ns, err := rands.UnicodeString(16, []rune(\"九七二人入八力十下三千上口土夕大\")) // =\u003e 下下口九力下土夕下土八上二夕大三\n\ns, err := rands.DNSLabel(16) // =\u003e z0ij9o8qkbs0ru-h\ns, err := rands.UUID()       // =\u003e a62b8712-f238-43ba-a47e-333f5fffe785\ns, err := rands.UUIDv7()     // =\u003e 01954a31-867f-7ffb-876e-b818f960ec3b\n\nn, err := rands.Int(2147483647)                   // =\u003e 1334400235\nn, err := rands.Int64(int64(9223372036854775807)) // =\u003e 8256935979116161233\n\nb, err := rands.Bytes(8) // =\u003e [0 220 137 243 135 204 34 63]\n\nerr := rands.Shuffle(len(arr), func(i, j) { arr[i], arr[j] = arr[j], arr[i] })\nerr := rands.ShuffleSlice(arr)\n```\n\n## [`randsmust`](https://pkg.go.dev/github.com/jimeh/rands/randsmust) package\n\n`randsmust` is specifically intended as an alternative to `rands` for use in\ntests. All functions return a single value, and panic in the event of an error.\nThis makes them easy to use when building structs in test cases that need random\ndata.\n\nFor production code, make sure to use the `rands` package and check returned\nerrors.\n\n### Import\n\n```\nimport \"github.com/jimeh/rands/randsmust\"\n```\n\n### Usage\n\n```go\ns := randsmust.Base64(16)       // =\u003e d1wm/wS6AQGduO3uaey1Cg==\ns := randsmust.Base64URL(16)    // =\u003e 4pHWVcddXsL_45vhOfCdng\ns := randsmust.Hex(16)          // =\u003e b5552558bc009264d129c422a666fe56\ns := randsmust.Alphanumeric(16) // =\u003e j5WkpNKmW8K701XF\ns := randsmust.Alphabetic(16)   // =\u003e OXxsqfFjNLvmZqDb\ns := randsmust.Upper(16)        // =\u003e AOTLYQRCVNMEPRCX\ns := randsmust.UpperNumeric(16) // =\u003e 1NTY6KATDVAXBTY2\ns := randsmust.Lower(16)        // =\u003e xmftrwvurrritqfu\ns := randsmust.LowerNumeric(16) // =\u003e yszg56fzeql7pjpl\ns := randsmust.Numeric(16)      // =\u003e 0761782105447226\n\ns := randsmust.String(16, \"abcdefABCDEF\")                               // =\u003e dfAbBfaDDdDFDaEa\ns := randsmust.UnicodeString(16, []rune(\"九七二人入八力十下三千上口土夕大\")) // =\u003e 十十千口三十十下九上千口七夕土口\n\ns := randsmust.DNSLabel(16) // =\u003e pu31o0gqyk76x35f\ns := randsmust.UUID()       // =\u003e d616c873-f3dd-4690-bcd6-ed307eec1105\ns := randsmust.UUIDv7()     // =\u003e 01954a30-add2-7590-8238-6cf6b2790c1e\n\nn := randsmust.Int(2147483647)                   // =\u003e 1293388115\nn := randsmust.Int64(int64(9223372036854775807)) // =\u003e 6168113630900161239\n\nb := randsmust.Bytes(8) // =\u003e [205 128 54 95 0 95 53 51]\n\nrandsmust.Shuffle(len(arr), func(i, j) { arr[i], arr[j] = arr[j], arr[i] })\nrandsmust.ShuffleSlice(arr)\n```\n\n## Documentation\n\nPlease see the Go Reference for documentation and examples:\n\n- [`rands`](https://pkg.go.dev/github.com/jimeh/rands)\n- [`randsmust`](https://pkg.go.dev/github.com/jimeh/rands/randsmust)\n\n## Benchmarks\n\nBenchmark reports and graphs are available here:\nhttps://jimeh.me/rands/dev/bench/\n\n## License\n\n[MIT](https://github.com/jimeh/rands/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimeh%2Frands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimeh%2Frands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimeh%2Frands/lists"}