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

Rand.Next(Int32, Int32) #23

Open
mazanuj opened this issue Mar 18, 2022 · 1 comment
Open

Rand.Next(Int32, Int32) #23

mazanuj opened this issue Mar 18, 2022 · 1 comment

Comments

@mazanuj
Copy link

mazanuj commented Mar 18, 2022

Your code doesn't include the last phone number from the list Link

[HttpGet]
public IActionResult Get()
{
    var randomNumber = random.Next(0, Phones.Numbers.Length - 1);
    return Ok(Phones.Numbers[randomNumber].ToString());
}

Screenshot 2022-03-19 003814

change random.Next(0, Phones.Numbers.Length - 1) to random.Next(0, Phones.Numbers.Length)

@303UsefulIdiots
Copy link

I would check how the count is used in the loop, this is written to start count at 0 and might not be the cause of the problem

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

2 participants