Ada’s Ada.Numerics.Float_Random and Ada.Numerics.Discrete_Random packages provide pseudorandom number generation.
To run the program, save it as random_numbers.adb and use the Ada compiler (e.g., GNAT):
Some of the generated numbers may be different when you run the sample.
See the Ada Reference Manual, specifically the Ada.Numerics.Float_Random and Ada.Numerics.Discrete_Random packages, for references on other random quantities that Ada can provide.
In Ada, we use separate packages for generating random floating-point numbers (Ada.Numerics.Float_Random) and random integers (Ada.Numerics.Discrete_Random). The Discrete_Random package is generic and needs to be instantiated with the desired integer type.
Unlike the original example, Ada doesn’t provide a built-in PCG (Permuted Congruential Generator). Instead, we demonstrate how to use a specific seed to get reproducible random sequences, which is conceptually similar to creating a new source with a known seed.