I have this code that multiplies 32 bit * 32 bit.
public static void RunSnippet()
{
System.Int32 x, y;
System.Int64 z;
System.Random rand = new System.Random(DateTime.Now.Millisecond);
for (int i = 0; i < 6; i++)
{
x = rand.Next(int.MinValue, int.MaxValue);
y = rand.Next(int.MinValue, int.MaxValue);
z = (x * y);
Console.WriteLine("{0} * {1} = {2}", x, y, z);
}
However, the result is not exactly what I expected.

What’s wrong with this?
Overflow. The result is calculated as a 32-bit integer and after that promoted to 64 bits. To avoid that, convert the factors to 64 bits before the multiplication.