Working on a little game for the BBC Microbit.
with Ada.Numerics.Discrete_Random
reports "Ada.Numerics" is not a predefined library unit.
Does Ada provide another way to generate random numbers on the BBC MicroBit? arch/ARM/Nordic/svd/nrf51/nrf51_svd-rng defines a random number generator record RNG_Peripheral. Is this what I'm searching for or only used with Bluetooth?
GPS 2018 (20180528) hosted on x86_64-pc-linux-gnu
GNAT Community 2018 (20180524-73)
Active toolchain: arm-eabi
the GNAT Programming Studio
(c) 2001-2018 AdaCore
My code:
with Ada.Numerics.Discrete_Random;
package body Flip_A_Coin is
package Random_Coin is new Ada.Numerics.Discrete_Random(Coin);
G: Random_Coin.Generator;
------------------
-- Reset --
------------------
procedure Reset is
begin
Random_Coin.Reset(G);
end Reset;
------------------
-- Flip --
------------------
function Flip
return Coin is
begin
return Random_Coin.Random(G);
end Flip;
begin
Reset;
end Flip_A_Coin;
G
??!! – Mawg says reinstate Monica