Posted on 2003-03-01
I am a biologist attempting to write simple programs to manipulate DNAsequences. I am attempting to self-teach myself C/C++ programming, so please excuse me if my questions seem incredibly simple or basic. The books I have purchased at the bookstore are good foundations, but offer limited practical examples.
Is there a way to shuffle character arrays in the same way as the typical card shuffling codes? I am seeking assistance in how I could go about "shuffling" an array of characters. I have an array, let's just call it aString, and I want to shuffle the characters of that array into another array called shufString. I want to be able to shuffle that string t quantity of times (t is fixed, based on pre-defined confidence levels).
I had thought of generating an index z that could be used to pick a character at random from aString as follows:
Am I at least headed into the right direction or barking up the wrong tree? And how would I go about placing the picked characters into the new array in the order they are chosen? Any assistance or ideas is greatly apprecited. Thanks in advance! :-)