File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11with Ada.Text_IO ; use Ada.Text_IO;
22with Ada.Characters.Latin_1 ;
3+ with Ada.Numerics ;
4+ with Ada.Float_text_IO ;
5+ with Ada.Numerics.Float_Random ;
36procedure Learn is
47
58 subtype Alphabet is Character range ' A' .. ' Z' ;
6-
9+ Random_Value : Float; My_Generator : Ada.Numerics.Float_Random.Generator;
710begin
8-
11+ -- Random_Value := 150.0;
912 Put_Line (" Learning Ada from " & Alphabet'First & " to " & Alphabet'Last);
1013 Ada.Text_IO.Put (Item => Ada.Characters.Latin_1.Copyright_Sign);
1114
15+ -- Initialize the generator from the system clock
16+ Ada.Numerics.Float_Random.Reset (My_Generator);
17+ for I in 1 ..800 loop
18+ -- Get a random float between 0.0 and 1.0
19+ Random_Value := Ada.Numerics.Float_Random.Random (My_Generator); -- Scale the float to between 100.0 and 250.0
20+ Random_Value := 150.0 * Random_Value + 100.0 ;
21+ Ada.Float_Text_IO.Put (Random_Value);
22+ end loop ;
1223end Learn ;
1324
You can’t perform that action at this time.
0 commit comments