class_docstr: Class providing the core functionality of a parameter, aka
  value, internal/model parameters, mutation, recombination
  and additional features such as shared random state,
  constraint check, hashes, generation and naming.
  The value field should sent to the function to optimize.
  
  Example
  -------
  >>> ng.p.Array(shape=(2,)).value
  array([0., 0.])
docstr: Sample a new instance of the parameter.
  This usually means spawning a child and mutating it.
  This function should be used in optimizers when creating an initial population,
  and parameter.heritage["lineage"] is reset to parameter.uid instead of its parent's
docstr_tok: ["Sample","a","new","instance","of","the","parameter",".","This","usually","means","spawning","a","child","and","mutating","it",".","This","function","should","be","used","in","optimizers","when","creating","an","initial","population",",","and","parameter.heritage","[","``","lineage","''","]","is","reset","to","parameter.uid","instead","of","its","parent","'s"]
code: def sample(self: P) -> P:
      """Sample a new instance of the parameter.
      This usually means spawning a child and mutating it.
      This function should be used in optimizers when creating an initial population,
      and parameter.heritage["lineage"] is reset to parameter.uid instead of its parent's
      """
      # inner working can be overrided by _layer_sample()
      self.random_state  # make sure to populate it before copy
      child = self._layers[-1]._layered_sample()
      if not isinstance(child, Parameter) and not isinstance(
          child, type(self)
      ):
          raise errors.NevergradRuntimeError(
              "Unexpected sample return type"
          )
      child._set_parenthood(None)
      return child
  
imports: import uuid
  import warnings
  import numpy
  import nevergrad.common.typing
  from nevergrad.common import errors
  from .None import utils
  from ._layering import ValueProperty
  from ._layering import Layered
  from ._layering import Level
label_desc: Use image node_id 8 for calling the Parameter obj's underlying member method code with example usage: obj.sample() and returns: child