Re: Processing numbers in random order
- From: "Phil" <obrienpw@xxxxxxxxxxxxxxx>
- Date: Wed, 19 Dec 2007 10:55:43 +1100
Maybe #2 was not thought through... but why is #1 incorrect?
Is it not possible to be at index 10 and request a random number from 1-10
and end up swapping 10 with 10?
Phil
----
"Arthur T." <arthur@xxxxxxxxxxxxxx> wrote in message
news:sclgm393hhvu5knqq34gjr22287s9pedaa@xxxxxxxxxx
In Message-ID:<47684e61$0$8430$afc38c87@xxxxxxxxxxxxxxxxxxxx>,
"Phil" <obrienpw@xxxxxxxxxxxxxxx> wrote:
I made changes to:
1) Not include the value of index i in the random number search - this
will
result in only replacing itself.
Making it less random because it's impossible to have a
number in the top half which doesn't move.
2) Stop half way on the assumption that if the top half of the array has
been toggled then the bottom half must also be done.
Making it *much* less random by greatly increasing the chance
that a number in the bottom half won't move.
#1 seemed likely on inspection and was confirmed by printing
the tables. I expected some problem with #2 and printing the
output showed the above problem.
--
Arthur T. - ar23hur "at" intergate "dot" com
Looking for a z/OS (IBM mainframe) systems programmer position
.
- Follow-Ups:
- Re: Processing numbers in random order
- From: Arthur T .
- Re: Processing numbers in random order
- From: Glenn Knickerbocker
- Re: Processing numbers in random order
- References:
- Processing numbers in random order
- From: Steve Swift
- Re: Processing numbers in random order
- From: Arthur T .
- Re: Processing numbers in random order
- From: Gerard Schildberger
- Re: Processing numbers in random order
- From: Phil
- Re: Processing numbers in random order
- From: Phil
- Re: Processing numbers in random order
- From: Arthur T .
- Processing numbers in random order
- Prev by Date: Re: Processing numbers in random order
- Next by Date: Re: Processing numbers in random order
- Previous by thread: Re: Processing numbers in random order
- Next by thread: Re: Processing numbers in random order
- Index(es):
Relevant Pages
|
Loading