Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RandInt : Provide simple overload or set defaults of min/max version to integer'low integer'high #85

Open
SkydiverTricky opened this issue Oct 13, 2023 · 0 comments

Comments

@SkydiverTricky
Copy link

In a usecase where I simply want a random integer, currently I need to call:

my_rand_int := rand.randInt(integer'low, integer'high);

This gives me RSI. How about a simple RandInt overload:

function RandInt return integer is
begin
  return randInt(integer'low, integer'high);
end function;

or simply provide default values on the min/max version:

function RandInt(min : integer := integer'low; max : integer := integer'high) return integer;

As far as I can tell, either would be backwards compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant