class_docstr: .. include:: /global.rst
  
  Please refer to |randomsearch| for more details about this algorithm.
class_docstr_tok: ["..","include",":",":","\/global.rst","Please","refer","to","|randomsearch|","for","more","details","about","this","algorithm","."]
docstr: Initializes the solver with bounds and a number of allowed evaluations.
  kwargs must be a dictionary of parameter-bound pairs representing the box constraints.
  Bounds are a 2-element list: [lower_bound, upper_bound].
  
  >>> s = RandomSearch(x=[0, 1], y=[-1, 2], num_evals=50)
  >>> s.bounds['x']
  [0, 1]
  >>> s.bounds['y']
  [-1, 2]
  >>> s.num_evals
  50
docstr_tok: ["Initializes","the","solver","with","bounds","and","a","number","of","allowed","evaluations",".","kwargs","must","be","a","dictionary","of","parameter-bound","pairs","representing","the","box","constraints",".","Bounds","are","a","2-element","list",":","[","lower_bound",",","upper_bound","]",".",">",">",">","s","=","RandomSearch","(","x=","[","0",",","1","]",",","y=","[","-1",",","2","]",",","num_evals=50",")",">",">",">","s.bounds","[","'","x","'","]","[","0",",","1","]",">",">",">","s.bounds","[","'","y","'","]","[","-1",",","2","]",">",">",">","s.num_evals","50"]
code: def __init__(self, num_evals, **kwargs):
      """Initializes the solver with bounds and a number of allowed evaluations.
      kwargs must be a dictionary of parameter-bound pairs representing the box constraints.
      Bounds are a 2-element list: [lower_bound, upper_bound].
  
      >>> s = RandomSearch(x=[0, 1], y=[-1, 2], num_evals=50)
      >>> s.bounds['x']
      [0, 1]
      >>> s.bounds['y']
      [-1, 2]
      >>> s.num_evals
      50
  
      """
      assert all(
          [len(v) == 2 and v[0] <= v[1] for v in kwargs.values()]
      ), "kwargs.values() are not [lb, ub] pairs"
      self._bounds = kwargs
      self._num_evals = num_evals
  
file_path: optunity/optunity/solvers/RandomSearch.py
imports: import operator
  import random
  from ..functions import static_key_order
  from .solver_registry import register_solver
  from .util import Solver, _copydoc, shrink_bounds, uniform_in_bounds
  from .None import util
label_desc: Use image node_id 1 to create a new RandomSearch object from inherited base classes: Solver with example: obj = RandomSearch(num_evals)