Leon wrote:
I need a program that generate 5 non-duplicates random number between 1-10
as string values store in an array.
Do anybody know of any good books or websites that explain how to generator
random numbers using asp.net?
Leon, in .NET you can use the Random class to generate a random number.
See the technical docs at
http://tinyurl.com/5b8m4
For your particular problem I'd do the following:
(1) Create an ArrayList with 10 elements, the numbers 1 through 10
(2) In a for loop that iterates 5 times, randomly choose a number, n,
between 1 and the size of the ArrayList.
(3) Your randomly chosen number is the number at element n in the
ArrayList. Remove this element from the ArrayList and go back to step (2).
This approach guarantees you 5 unique random numbers with 5 tries. hth
--
Scott Mitchell
mi******@4guysfromrolla.com http://www.4GuysFromRolla.com
* When you think ASP.NET, think 4GuysFromRolla.com!