Boy, that sounds like homework.
I'll help you, primarily to point you in the right direction. If this is a
professional app, let me know if I'm being to "cagey".
What you have: a random number generator that generates a single value in a
range.
What you need: to order all of the numbers in a range in a random sequence.
Your need is substantially different than what you have. So you cannot
approach the problem directly.
Look at the "what you need" statement. You have a requirement: all of the
numbers in a range. Start there.
How would you create a list of all of the numbers in a range?
Now, look at the other part of your requirement: arrange them in a random
sequence.
So, each of the numbers in your range has a "natural" position, but we need
to ignore that, and give each of your numbers a new position.
So each of your numbers needs to have another value attached to it: the new
position.
In other words, you have pairs. The number and it's new position.
How would you make a list of pairs?
How would you create a random number for the new position? Would that
position value have to be in the same range as the original list of numbers?
How would you reorder your list based on the new position value?
How would you print out the ordered list?
(As you can see, I broke down your problem into steps and hopefully gave
guidance without giving away the method.)
Good Luck,
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Aaron" <ku*****@yahoo.com> wrote in message
news:u0*************@TK2MSFTNGP10.phx.gbl...
I need some help writing this function
the function returns a list of random non-duplicate integers in a string,
1 parameter indicating the maximum range.
string randGen(int maxRange)
maxRange=1000
the output would be:
total of 1000 numbers from 1 - 1000 randomly
2,6,3,423,123,673,23,53...
I know how to write the random number generator part but im having trouble
with the non-duplicate part.
any help is appreciated.
Aaron