Re: Randomly outputting an array
- From: Gerry Quinn <gerryq@xxxxxxxxxxxxxxxxxxx>
- Date: Sun, 16 Jul 2006 14:24:19 +0100
In article <1152899358.709256.89380@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
ryanarossi@xxxxxxxxx says...
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.
Swap every element in the array with a random element of the array (may
include itself, in which case no actual swap is needed).
This will still work if you do it in stages, e.g. do it for the first
five elements, then remove them.
- Gerry Quinn
.
- References:
- Randomly outputting an array
- From: ryanarossi@xxxxxxxxx
- Randomly outputting an array
- Prev by Date: Re: C is too old? opinions?
- Next by Date: Re: Randomly outputting an array
- Previous by thread: Re: Randomly outputting an array
- Next by thread: Re: Randomly outputting an array
- Index(es):
Relevant Pages
|