Tag Archives: randomization

Generate letters with given frequencies in C#

This example generates random letters with the frequencies they have in normal English text. The following code shows how the example gets started. // The letter frequencies. See: // http://en.wikipedia.org/wiki/Letter_frequency private float[] Frequencies = { 8.167f, 1.492f, 2.782f, 4.253f, 12.702f, … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , , , , | Leave a comment

Generate random data in an Access database in C#

This example shows how you can generate random data for students and their test scores in an Access database. I often build examples that manipulate databases. Those examples are more interesting if the database holds lots of data, but it’s … Continue reading

Posted in ADO.NET, algorithms, database | Tagged , , , , , , , , , , , , , , | Leave a comment

Make extension methods that randomize arrays and lists in C#

This example uses the techniques described in the post Randomize arrays in C# to make extensions methods that randomize arrays and lists. Extension methods must be in a public static class. This example creates a RandomizationExtensions class. That class declares … Continue reading

Posted in algorithms, extension methods, mathematics | Tagged , , , , , , , , , , , | 1 Comment

Randomize arrays in C#

This example builds a Randomizer class that lets you randomize arrays. It provides a generic Randomize method that randomizes an array containing any kind of data. The following code shows the class. public class Randomizer { public static void Randomize<T>(T[] … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , , , , | 7 Comments