Re: Randomly outputting an array



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?

That depends on your definition of 'simplest' and 'random'. A simple -
but probably far from effective - method would be to just shuffle the
array some time by swapping random elements, and then print all the
elements in sequence.

--
:wq
^X^Cy^K^X^C^C^C^C
.



Relevant Pages

  • Re: convert nested for loop to recursion
    ... then a number of suggestions for design changes ... Identify the simplest possible instance of the generalized problem. ... Express the top-level problem as an instance of the generalized one. ... and a is the array. ...
    (comp.lang.java.programmer)
  • Re: Pool module -- does map pre-assign tasks to processes?
    ... Luca wrote: ... The simplest way to write ... the code would be to put all task descriptions in an array, ...
    (comp.lang.python)
  • Re: Clean Up Code - consolidate steps
    ... There is no pattern to the values so the simplest thing is to simplify the ... You could also load an array ...
    (microsoft.public.excel.misc)
  • Re: Array into list of arguments - nicest way?
    ... Max Williams wrote: ... I want to pass the contents of an array to a method, ... What's the simplest and nicest way of ... RMagick: http://rmagick.rubyforge.org/ ...
    (comp.lang.ruby)
  • Re: Olaf Schmidt - sort routine
    ... cSortStrings. ... The array inside the class is usually going to be bigger than the number ... The simplest approach would be to try ...
    (microsoft.public.vb.general.discussion)