Several small optimizations; improved XML comments; added a text file for storing general ideas about the design of Nuclex.Support

git-svn-id: file:///srv/devel/repo-conversion/nusu@15 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2007-05-08 18:42:00 +00:00
parent 88390bc38d
commit 7ec11b91b9
6 changed files with 49 additions and 18 deletions

28
Nuclex.Support.txt Normal file
View file

@ -0,0 +1,28 @@
#if DEBUG
/// <summary>Generates a new random shuffle table</summary>
/// <param name="iterationCount">
/// Number of iterations in which to randomize the shuffle table
/// </param>
/// <returns>The new random shuffle table</returns>
public static byte[] generateShuffleTable(int iterationCount) {
byte[] shuffleTable = new byte[128];
for(int index = 0; index < 128; ++index)
shuffleTable[index] = index;
Random rng = new Random();
for(int iteration = 0; iteration < iterationCount; ++iteration) {
int firstIndex = rng.Next() % 128;
int secondIndex = rng.Next() % 128;
byte temp = shuffleTable[firstIndex];
shuffleTable[firstIndex] = shuffleTable[secondIndex];
shuffleTable[secondIndex] = temp;
}
return shuffleTable;
}
#endif