¡@

Home 

c# Programming Glossary: rng

C# producer/consumer

http://stackoverflow.com/questions/1656404/c-sharp-producer-consumer

new Thread new ThreadStart ConsumerJob .Start Random rng new Random 0 for int i 0 i 10 i Console.WriteLine Producing.. Producing 0 i queue.Produce i Thread.Sleep rng.Next 1000 static void ConsumerJob Make sure we get a different.. get a different random seed from the first thread Random rng new Random 1 We happen to know we've only got 10 items to receive..

How can I generate a cryptographically secure pseudorandom number in C#?

http://stackoverflow.com/questions/1668353/how-can-i-generate-a-cryptographically-secure-pseudorandom-number-in-c

System.Security.Cryptography ... RandomNumberGenerator rng new RNGCryptoServiceProvider byte tokenData new byte 32 rng.GetBytes.. new RNGCryptoServiceProvider byte tokenData new byte 32 rng.GetBytes tokenData string token Convert.ToBase64String tokenData..

Hash and salt passwords in C#

http://stackoverflow.com/questions/2138429/hash-and-salt-passwords-in-c-sharp

a cryptographic random number. RNGCryptoServiceProvider rng new RNGCryptoServiceProvider byte buff new byte size rng.GetBytes.. rng new RNGCryptoServiceProvider byte buff new byte size rng.GetBytes buff Return a Base64 string representation of the random..

How can i get the Cell address from excel

http://stackoverflow.com/questions/2628603/how-can-i-get-the-cell-address-from-excel

some more public string RangeAddress Excel.Range rng return rng.get_AddressLocal false false Excel.XlReferenceStyle.xlA1.. more public string RangeAddress Excel.Range rng return rng.get_AddressLocal false false Excel.XlReferenceStyle.xlA1 missing..

Randomize a List<T> in C#

http://stackoverflow.com/questions/273313/randomize-a-listt-in-c-sharp

public static void Shuffle T this IList T list Random rng new Random int n list.Count while n 1 n int k rng.Next n 1 T.. Random rng new Random int n list.Count while n 1 n int k rng.Next n 1 T value list k list k list n list n value Usage List.. was intended. In my first example above I instantiate the rng variable inside of the Shuffle method which is asking for trouble..

PBKDF2 in Bouncy Castle C#

http://stackoverflow.com/questions/3210795/pbkdf2-in-bouncy-castle-c-sharp

namespace. RNGCryptoServiceProvider rng new RNGCryptoServiceProvider byte salt new byte 16 rng.GetBytes..

openssl using only .NET classes

http://stackoverflow.com/questions/5452422/openssl-using-only-net-classes

byte key iv byte salt new byte 8 RNGCryptoServiceProvider rng new RNGCryptoServiceProvider rng.GetNonZeroBytes salt DeriveKeyAndIV.. RNGCryptoServiceProvider rng new RNGCryptoServiceProvider rng.GetNonZeroBytes salt DeriveKeyAndIV passphrase salt out key.. byte key iv byte salt new byte 8 RNGCryptoServiceProvider rng new RNGCryptoServiceProvider rng.GetNonZeroBytes salt DeriveKeyAndIV..

An extension method on IEnumerable needed for shuffling

http://stackoverflow.com/questions/5807128/an-extension-method-on-ienumerable-needed-for-shuffling

IEnumerable T Shuffle T this IEnumerable T source var rng new Random return source.Shuffle rng public static IEnumerable.. T source var rng new Random return source.Shuffle rng public static IEnumerable T Shuffle T this IEnumerable T source.. IEnumerable T Shuffle T this IEnumerable T source Random rng if source null throw new ArgumentNullException source if rng..

Generating a Random Decimal in C#

http://stackoverflow.com/questions/609501/generating-a-random-decimal-in-c-sharp

values. summary public static int NextInt32 this Random rng unchecked int firstBits rng.Next 0 1 4 28 int lastBits rng.Next.. int NextInt32 this Random rng unchecked int firstBits rng.Next 0 1 4 28 int lastBits rng.Next 0 1 28 return firstBits.. unchecked int firstBits rng.Next 0 1 4 28 int lastBits rng.Next 0 1 28 return firstBits lastBits public static decimal..

Using EPPlus, I am trying to export a gridview to an Excel Sheet

http://stackoverflow.com/questions/9574279/using-epplus-i-am-trying-to-export-a-gridview-to-an-excel-sheet

Format the header for column 1 3 using ExcelRange rng ws.Cells A1 E1 rng.Style.Font.Bold true Set Pattern for the.. for column 1 3 using ExcelRange rng ws.Cells A1 E1 rng.Style.Font.Bold true Set Pattern for the background to Solid.. true Set Pattern for the background to Solid rng.Style.Fill.PatternType ExcelFillStyle.Solid Set color to dark..