Junior — Senior
Creating a list of N distinct random integers
livecode
Task condition
It is necessary to implement a function that returns N unique integers as a slice ([]int).
Requirements:
- Use the
math/randpackage for generation (for example,rand.Int()). - The resulting slice should not contain duplicate values.
- The solution should be efficient for large values of N, avoiding infinite or excessively long loops when selecting new numbers.
Example function signature: func GenerateUnique(count int) []int.
Important: keep all mentioned code elements unchanged, only modify the wording and variable names in the text.