Re: Randomly outputting an array



On 14 Jul 2006 10:49:18 -0700, "ryanarossi@xxxxxxxxx"
<ryanarossi@xxxxxxxxx> wrote:

What would be the simplest way to output an array in random order, but
every element in the array MUST be outputted and the elements cannot
repeat? My current code is below, which I simply have a very large
array and I am outputting windows of an arbitary length.

int c = 0;
int p = windowSize;
int q = 0;
int index = 0;
while (c < counter0 - (windowSize - 1))
{
for (index = q; index < p; index++)
{
Writer.Write(geneArray0[index]);
Writer.Write(" ");
}
Writer.Write("1");
Writer.WriteLine();
q++;
p++;
c++;
}
Knuth, Vol 2, Algorithm 3.4.2P

rossum

.



Relevant Pages

  • Randomly outputting an array
    ... every element in the array MUST be outputted and the elements cannot ... array and I am outputting windows of an arbitary length. ... int p = windowSize; ...
    (comp.programming)
  • (patch for Bash) regex case statement
    ... Following up on my previous patch for regex conditional tests, ... /* Return an array of strings; ... int dollarflag, zeropad, compareflag; ... SHELL_VAR *var; ...
    (comp.unix.shell)
  • Re: Strategy or Iterator?
    ... It would be possible to write a class that returns the variations ... GNU General Public License for more details. ... protected CombinatoricOperator(Telements, int r) { ... An integer array backing up the original one to keep track of the ...
    (comp.lang.java.programmer)
  • (patch for Bash) regex conditional tests
    ... 'regex' are returned in array variable SUBMATCH. ... Skipping of positional parameters, array elements, string ... int dollarflag, zeropad, compareflag; ... SHELL_VAR *var; ...
    (comp.unix.shell)
  • Re: Warning on assigning a function-returning-a-pointer-to-arrays
    ... This declares pfunc as a function taking no arguments and returning ... int x, y; ... Presumably pfuncwill return a pointer to a single int, ... or the first of a sequence of "array 5 of int"s. ...
    (comp.lang.c)