
Answer-first summary for fast verification
Answer: hp.randint(label, upper)
The correct answer is `hp.randint(label, upper)`, as it is specifically designed to generate random integers within a specified range. The `label` serves as an identifier for the hyperparameter, and `upper` defines the upper bound (exclusive) for the random integer generation. Values are chosen from 0 (inclusive) up to, but not including, `upper`. Other options are not suitable for this purpose: - `hp.quniform(label, low, high, q)`: Generates random numbers following a q-uniform distribution within a specified range, not guaranteeing integers or the desired range. - `hp.uniform(label, low, high)`: Generates random floats within a specified range, not integers. - `hp.choice(label, options)`: Selects a random element from a list of predefined options, not suitable for generating random integers within a specific range. Thus, `hp.randint(label, upper)` is the most appropriate function for generating random integers in the range [0, upper).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.