title: OrderBy boolean of char array
body: <p>I analyzed code of malware written in C# and came across something unclear to me. The LINQ <code>OrderBy</code> method was applied on a <code>char</code> array. However, I was suprised about the lambda expression inside, which was similar to the one below.</p>
  <pre><code>var charArray = &quot;abcdefghijk&quot;.ToCharArray();
  
  string generatedString = new string(charArray
    .OrderBy(s =&gt; (random.Next(2) % 2) == 0)
    .ToArray());
  </code></pre>
  <p>I wonder how it works if the expression value is <code>bool</code>. It is also puzzling to me that if I put simple <code>true</code> or <code>false</code> values there instead, I always get the same <code>string</code> of &quot;abcdefghijk&quot; characters. Why is it always mixed up with this expression?</p>