Method to randomise a string's case I'm an amateur at programming and have created the following method with which I pass a lowercase string with the idea it is then returned either in it's original lowercase format, Capitalised or UPPERCASE. I'm not sure this is the best way or is truly &quot;random&quot; but does work up to a point but would like pointers on any improvements or different ways to achieve this.
        //==============================================================================
        // Randomise string case
        //==============================================================================
        private string randomCase (string word)
        {
            string changed;
            Random r = new Random(Guid.NewGuid().GetHashCode());
            int n = r.Next(1, 29);

            if (n &gt;= 1 &amp;&amp; n &lt;= 9)
            {
                // First letter capatalised
                changed = char.ToUpper(word[0]) + word.Substring(1);
                return changed;
            }
            else if (n &gt;= 10 &amp;&amp; n &lt;= 19)
            {
                // Word capatalised
                changed = word.ToUpper();
                return changed;
            }
            else if (n &gt;= 20 &amp;&amp; n &lt;= 29)
            {
                // Left as lower case
                return word;
            }

            return null;
        }
This entire method should be static, as it clearly does not require an object
new Random(Guid.NewGuid().GetHashCode()) is needlessly complicated. new Random() is initialized based on time by default
A simpler range from [0,2] can be used.
The changed variable can be entirely replaced by a switch and return structure

private static string Capitalized(string word) {
    return char.ToUpper(word[0]) + word.Substring(1);
}

private static string RandomCase(string word)
{
    int choice = new Random().Next(3);
    switch(choice) {
        case 0: return Capitalized(word);
        case 1: return word.ToUpper();
        case 2: default: return word;
    }
}