I am not very familiar with arrays but I need to use one for a program I'm making so my question is, is there any way to randomly assign the data in one array to the data in another. I'm trying to randomly assign specific values so I can't use a random number generator.
July 24th, 2009, 01:58 AM
PredicateNormative
Re: Arrays
Is this homework?
Are you coding in C or C++?
July 24th, 2009, 04:38 AM
Peter_APIIT
Re: Arrays
OK. The idea like this.
Initialize first value with zero, second value with one and increment the value and assign to next index. After finish assign, random shuffle it.
Then using std::copy algorithm to another array.
July 24th, 2009, 07:08 AM
Rich2189
Re: Arrays
You can't use the random number generator to generate specific values yes, but you can use it to generate random array indexs to copy your specific values to.