July 24th, 2009, 02:16 AM
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, 02:58 AM
Is this homework?
Are you coding in C or C++?
July 24th, 2009, 05:38 AM
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.
Thanks for your help.
July 24th, 2009, 08:08 AM
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.
Last edited by Rich2189; July 24th, 2009 at 03:13 PM.
Visual Studio 2010 Professional | Windows 7 (x64)
July 24th, 2009, 11:02 AM
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.