Tag Archives: randomization

New Book: The Modern C# Challenge

My latest book, The Modern C# Challenge, is now available. It’s a collection of 100 programming challenges that let you test your ability in a wide variety of programming topics, many of which are not usually covered in traditional programming … Continue reading

Posted in algorithms, books, files, mathematics, puzzles | Tagged , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

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