The example doesn't pay attention, Random.Next is not thread-safe.
There are 10 threads all using the same "Random" object.
It should be ensured, there's always just one thread at a time generating a number.
public void DoTransactions()
{
for (int i = 0; i < 100; i++)
{
int amount;
lock(r)
{
amount = r.Next(1,00);
}
Withdraw(amount);
}
}