Tindi.Random.Library 1.0.4

dotnet add package Tindi.Random.Library --version 1.0.4                
NuGet\Install-Package Tindi.Random.Library -Version 1.0.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tindi.Random.Library" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tindi.Random.Library --version 1.0.4                
#r "nuget: Tindi.Random.Library, 1.0.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Tindi.Random.Library as a Cake Addin
#addin nuget:?package=Tindi.Random.Library&version=1.0.4

// Install Tindi.Random.Library as a Cake Tool
#tool nuget:?package=Tindi.Random.Library&version=1.0.4                

Simple random library to generate random value from given range, character, guid, string, byte[]

Tindi.Random sample usage:

using Microsoft.Extensions.DependencyInjection; using Tindi.Random.Library; Console.WriteLine("Hello, World!");

Tindi.Random.Library.Startup.Init(); var randomServiceDI = Tindi.Random.Library.Startup.ServiceProvider.GetService<IRandom>(); Console.WriteLine(randomServiceDI.GetCharCapitalLetter());

//var randomService = new Tindi.Random.Library.Random();

Console.WriteLine(randomServiceDI.GetInteger(200, 100, 150)); Console.WriteLine(randomServiceDI.GetGuid().ToString());

string code = "";

for (int i = 0; i < 6; i++) { code = code + randomServiceDI.GetCharDigit(); }

Console.WriteLine(code); Console.ReadLine();

************* MORE SOPHISTICATED SAMPLE *************** // See https://aka.ms/new-console-template for more information using Microsoft.Extensions.DependencyInjection; using Tindi.Email.Library; using Tindi.Random.Library; using Tindi.PasswordValidator.Library;

ServiceProvider serviceProvider;

serviceProvider = new ServiceCollection() .ConfigureTindiMailingSystem() .ConfigureTindiPasswordValidatorLibrary() .ConfigureTindiRandomLibrary() .AddScoped<sample>() .BuildServiceProvider();

Console.WriteLine("Hello start");

//Tindi.Email.Library.Startup.Init(); //var emailService = Tindi.Email.Library.Startup.ServiceProvider.GetService<IEmail>();

var emailService = serviceProvider.GetService<IEmail>(); var passwordValidatorService = serviceProvider.GetService<IPasswordValidator>(); var randomService = serviceProvider.GetService<IRandom>();

bool isValidPassword = passwordValidatorService.IsValid("dupa#43"); if (isValidPassword == false) { foreach (var item in passwordValidatorService.failedChecks) { Console.WriteLine(item); } }

var newRandom = serviceProvider.GetService<sample>(); newRandom.GenerateRandom();

Console.WriteLine(randomService.GetInteger(100).ToString());

emailService.RegisterSenderDetails("smtp.gmail.com", 587, "xxxx@gmail.com", "yourapplicationGmailPasswordSettableInYourGoogleAccount"); emailService.ComposeMailMessage("youremail@something.com", "sent from:)", "First experiments"); emailService.Send();

Console.WriteLine("sent"); Console.ReadLine();

public class sample {

private IRandom random; public sample(IRandom random) { this.random = random; }

public void GenerateRandom() { Console.WriteLine(random.GetCharCapitalLetter()); } }

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 313 1/9/2022
1.0.3 246 12/28/2021
1.0.2 249 12/28/2021
1.0.1 239 12/27/2021
1.0.0 235 12/27/2021

Added generating random bytes [] and random string of specific length