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: Creates a RandomSearch solver that uses ``num_evals`` evaluations
  within given bounds (lb, ub). The bounds are first tightened, resulting in
  new bounds covering 99% of the area.
  
  >>> s = RandomSearch.suggest_from_box(30, x=[0, 1], y=[-1, 0], z=[-1, 1])
  >>> s['x'] #doctest:+SKIP
  [0.005, 0.995]
  >>> s['y'] #doctest:+SKIP
  [-0.995, -0.005]
  >>> s['z'] #doctest:+SKIP
  [-0.99, 0.99]
  >>> s['num_evals']
  30
  
  Verify that we can effectively make a solver from box.
  
  >>> s = RandomSearch.suggest_from_box(30, x=[0, 1], y=[-1, 0], z=[-1, 1])
  >>> solver = RandomSearch(**s)
docstr_tok: ["Creates","a","RandomSearch","solver","that","uses","``","num_evals","``","evaluations","within","given","bounds","(","lb",",","ub",")",".","The","bounds","are","first","tightened",",","resulting","in","new","bounds","covering","99","%","of","the","area",".",">",">",">","s","=","RandomSearch.suggest_from_box","(","30",",","x=","[","0",",","1","]",",","y=","[","-1",",","0","]",",","z=","[","-1",",","1","]",")",">",">",">","s","[","'","x","'","]","#","doctest",":","+SKIP","[","0.005",",","0.995","]",">",">",">","s","[","'","y","'","]","#","doctest",":","+SKIP","[","-0.995",",","-0.005","]",">",">",">","s","[","'","z","'","]","#","doctest",":","+SKIP","[","-0.99",",","0.99","]",">",">",">","s","[","'num_evals","'","]","30","Verify","that","we","can","effectively","make","a","solver","from","box",".",">",">",">","s","=","RandomSearch.suggest_from_box","(","30",",","x=","[","0",",","1","]",",","y=","[","-1",",","0","]",",","z=","[","-1",",","1","]",")",">",">",">","solver","=","RandomSearch","(","*","*","s",")"]
code: def suggest_from_box(num_evals, **kwargs):
      """Creates a RandomSearch solver that uses ``num_evals`` evaluations
      within given bounds (lb, ub). The bounds are first tightened, resulting in
      new bounds covering 99% of the area.
  
      >>> s = RandomSearch.suggest_from_box(30, x=[0, 1], y=[-1, 0], z=[-1, 1])
      >>> s['x'] #doctest:+SKIP
      [0.005, 0.995]
      >>> s['y'] #doctest:+SKIP
      [-0.995, -0.005]
      >>> s['z'] #doctest:+SKIP
      [-0.99, 0.99]
      >>> s['num_evals']
      30
  
      Verify that we can effectively make a solver from box.
  
      >>> s = RandomSearch.suggest_from_box(30, x=[0, 1], y=[-1, 0], z=[-1, 1])
      >>> solver = RandomSearch(**s)
  
      """
      d = shrink_bounds(kwargs)
      d["num_evals"] = num_evals
      return d
  
file_path: optunity/wrappers/R/inst/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 2 for calling the RandomSearch obj's underlying member method code with example usage: obj.suggest_from_box(num_evals) and returns: d