From: Simon Wright <simon@pushface.org>
Subject: Re: How to shuffle/jumble letters of a given word?
Date: Mon, 29 Jun 2015 09:05:50 +0100
Date: 2015-06-29T09:05:50+01:00 [thread overview]
Message-ID: <ly7fqnaqht.fsf@pushface.org> (raw)
In-Reply-To: mmpoht$ifl$1@dont-email.me
"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));
end loop;
Sort (Keyed);
next prev parent reply other threads:[~2015-06-29 8:05 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 [this message]
2015-06-29 8:13 ` Dmitry A. Kazakov
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