Tedd.RandomUtils
1.0.0
See the version list below for details.
dotnet add package Tedd.RandomUtils --version 1.0.0
NuGet\Install-Package Tedd.RandomUtils -Version 1.0.0
<PackageReference Include="Tedd.RandomUtils" Version="1.0.0" />
paket add Tedd.RandomUtils --version 1.0.0
#r "nuget: Tedd.RandomUtils, 1.0.0"
// Install Tedd.RandomUtils as a Cake Addin #addin nuget:?package=Tedd.RandomUtils&version=1.0.0 // Install Tedd.RandomUtils as a Cake Tool #tool nuget:?package=Tedd.RandomUtils&version=1.0.0
Extension methods
Extension methods for System.Random that adds support for more datatypes. NextSByte(), NextByte(), NextInt16(), NextUInt16(), NextIn32(), NextUInt32(), NextInt64(), NextUInt64() and NextFloat().
Note on vanilla System.Random vs this library
Standard System.Random.Next() returns a positive integer, while all this library return full range of values for given datatype. Standard System.Random.Next(from, to) has "exclusive to" value, meaning it only returns 31 random bits in the 32-bit integer. This library returns random for all 32 and 64 bits on NextInt32(), NextUInt32, NextInt64() and NextUInt64() respectively.
Examples
Random by type
var rnd = new Random();
sbyte val1 = rnd.NextSByte();
byte val1 = rnd.NextByte();
short val2 = rnd.NextInt16();
ushort val3 = rnd.NextUInt16();
int val4 = rnd.NextInt32();
uint val5 = rnd.NextUInt32();
long val6 = rnd.NextInt64();
ulong val7 = rnd.NextUInt64();
float val8 = rnd.NextFloat();
Thread safe random
Thread safe random without locking.
sbyte val1 = ConcurrentRandom.NextSByte();
byte val1 = ConcurrentRandom.NextByte();
short val2 = ConcurrentRandom.NextInt16();
ushort val3 = ConcurrentRandom.NextUInt16();
int val4 = ConcurrentRandom.NextInt32();
uint val5 = ConcurrentRandom.NextUInt32();
long val6 = ConcurrentRandom.NextInt64();
ulong val7 = ConcurrentRandom.NextUInt64();
float val8 = ConcurrentRandom.NextFloat();
Crypto strength random
using rnd = new CryptoRandom();
sbyte val1 = rnd.NextSByte();
byte val1 = rnd.NextByte();
short val2 = rnd.NextInt16();
ushort val3 = rnd.NextUInt16();
int val4 = rnd.NextInt32();
uint val5 = rnd.NextUInt32();
long val6 = rnd.NextInt64();
ulong val7 = rnd.NextUInt64();
float val8 = rnd.NextFloat();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 is compatible. netcoreapp2.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 is compatible. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.1 is compatible. |
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 2.0
- No dependencies.
-
.NETCoreApp 2.1
- No dependencies.
-
.NETCoreApp 3.0
- No dependencies.
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.