Pick random element: Difference between revisions

Content deleted Content added
Line 3:
 
=={{header|Ada}}==
 
The following program generates three 20-letter words. Each words 10 random vowels and 10 random consonants (only consonants frequent in English are availabe):
 
<lang Ada>with Ada.Text_IO, Ada.Numerics.Float_Random;
Line 14 ⟶ 16:
 
function Pick_Random(A: Char_Arr) return Character is
-- Chooses one of the characters of A (uniformly distributed)
-- Index: Natural := Natural(Rnd.Random(Gen) * Float(A'Length));
begin
return A(A'First + Natural(Rnd.Random(Gen) * Float(A'Last)));