From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: How to shuffle/jumble letters of a given word?
Date: Mon, 29 Jun 2015 10:13:23 +0200
Date: 2015-06-29T10:13:23+02:00 [thread overview]
Message-ID: <1oqptnzfvfrwi$.3rezbni7b1lm$.dlg@40tude.net> (raw)
In-Reply-To: ly7fqnaqht.fsf@pushface.org
On Mon, 29 Jun 2015 09:05:50 +0100, Simon Wright wrote:
> "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> writes:
>
>> On 06/28/2015 02:07 PM, Simon Wright wrote:
>>>
>>> Then, given a String, create an Elements array with each Key a new
>>> random number and each Ch the corresponding character in the String;
>>> sort it (which, since the Keys were random, is effectively a shuffle);
>>> and return a String formed of the Chs in their new order.
>>
>> You could also just sort the String.
>
> I don't see how this would work?
>
> Though I see I made myself less than clear. At the risk of solving even
> more of the OP's problem for her than I already have,
>
> Keyed : Elements (Str'Range);
> begin
> for J in Str'Range loop
> Keyed (J) := (Ada.Numerics.Float_Random.Random (Gen), Str (J));
It should be non-repeating random numbers in this case, provided
"shuffling" meant permutation.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2015-06-29 8:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-28 14:06 How to shuffle/jumble letters of a given word? Trish Cayetano
2015-06-28 15:52 ` David Botton
2015-06-28 16:01 ` Anh Vo
2015-06-28 21:07 ` Simon Wright
2015-06-28 21:23 ` Jeffrey R. Carter
2015-06-29 8:05 ` Simon Wright
2015-06-29 8:13 ` Dmitry A. Kazakov [this message]
2015-06-29 18:04 ` Jeffrey R. Carter
2015-07-02 20:56 ` Randy Brukardt
2015-06-29 13:42 ` darkestkhan
2015-06-29 20:21 ` Austin Obyrne
2015-06-29 21:45 ` MM
2015-06-30 12:29 ` Austin Obyrne
2015-07-01 10:40 ` darkestkhan
2015-08-09 21:50 ` David Thompson
2015-08-10 15:20 ` darkestkhan
2015-07-11 15:29 ` Trish Cayetano
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox