Click here to Skip to main content
15,895,423 members

Comments by Zimin Max Yang (Top 1 by date)

Zimin Max Yang 28-Feb-12 0:41am View    
I don't get your algorithm.

First, there is a syntax error in your if statement, you can not pass a "Random" object to Contains() which needs "String".

Let's assume you really want to do is "richTextBox1.Text.Contains(num.Next().ToString())", then even there is no match to the first num.Next().ToString(), you are calling num.Next() multiple times and there still has a chance an existing number is generated again.

No matter how you compare, you are sure to get repeating numbers.