August 23, 2024

P24 - Lotto: Draw N different random numbers from the set 1..M.

Example:

> p24:lotto(3, 49).
    [38,43,20]

erlang

% Lotto: Draw N different random numbers from the set 1..M.
-module(p24).
-export([lotto/2]).

lotto(N, Limit) -> 
    p23:randomSelect(N, p22:range(1, Limit)).
Be first to comment
Leave a reply