Czlovek.Randomness
3.0.0-beta.2
See the version list below for details.
dotnet add package Czlovek.Randomness --version 3.0.0-beta.2
NuGet\Install-Package Czlovek.Randomness -Version 3.0.0-beta.2
<PackageReference Include="Czlovek.Randomness" Version="3.0.0-beta.2" />
<PackageVersion Include="Czlovek.Randomness" Version="3.0.0-beta.2" />
<PackageReference Include="Czlovek.Randomness" />
paket add Czlovek.Randomness --version 3.0.0-beta.2
#r "nuget: Czlovek.Randomness, 3.0.0-beta.2"
#:package Czlovek.Randomness@3.0.0-beta.2
#addin nuget:?package=Czlovek.Randomness&version=3.0.0-beta.2&prerelease
#tool nuget:?package=Czlovek.Randomness&version=3.0.0-beta.2&prerelease
Randomness
Utils is a static class for generating random numbers. It contains a global instance of Random used to generate seeds, which are then used to create new instances of Random on a per-thread basis.
Usage
To use Utils, simply call one of the provided static methods:
var randomInt = Utils.Next();
var randomDouble = Utils.NextDouble();
var randomBytes = new byte[16];
Utils.NextBytes(randomBytes);
If you need to use a Random instance across multiple methods or threads, you can create a new instance of Random using Utils.NewRandom():
var random = Utils.NewRandom();
var randomInt = random.Next();
Note that NewRandom() will create a new instance of Random with a seed derived from the global instance of Random. If you need a more secure seed, you should use a cryptographic random number generator instead.
Methods
Instance: Returns a thread-local instance ofRandomthat can be used freely within the current thread.NewRandom(): Creates a new instance ofRandomwith a seed derived from the global instance ofRandom.Next(): Returns a random non-negative integer.Next(int maxValue): Returns a random non-negative integer less than the specifiedmaxValue.Next(int minValue, int maxValue): Returns a random integer within the specified range.NextDouble(): Returns a random double between 0.0 and 1.0.NextBytes(byte[] buffer): Fills the specified byte array with random numbers.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Czlovek.Randomness:
| Package | Downloads |
|---|---|
|
Czlovek.HttpCommunication
Correlation-ID middleware and helpers, random user agents and file download for ASP.NET Core applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0-beta.10 | 52 | 11/22/2026 |
| 3.0.0-beta.9 | 54 | 11/22/2026 |
| 3.0.0-beta.8 | 61 | 11/21/2026 |
| 3.0.0-beta.6 | 102 | 9/29/2026 |
| 3.0.0-beta.5 | 99 | 9/27/2026 |
| 3.0.0-beta.4 | 76 | 9/27/2026 |
| 3.0.0-beta.3 | 74 | 9/27/2026 |
| 3.0.0-beta.2 | 82 | 9/27/2026 |
| 3.0.0-beta.1 | 113 | 7/19/2026 |
| 2.1.0-beta.85 | 122 | 6/16/2026 |
| 2.1.0-beta.84 | 96 | 5/7/2026 |
| 2.1.0-beta.83 | 88 | 5/7/2026 |
| 2.1.0-beta.82 | 139 | 3/20/2026 |
| 2.1.0-beta.81 | 114 | 2/21/2026 |
| 2.1.0-beta.80 | 100 | 2/21/2026 |
| 2.1.0-beta.79 | 116 | 2/13/2026 |
| 2.1.0-beta.78 | 107 | 2/11/2026 |
| 2.1.0-beta.77 | 99 | 2/11/2026 |
| 2.1.0-beta.76 | 105 | 2/10/2026 |
| 1.0.10 | 972 | 4/11/2023 |