docstr: This function generates samples of uniform distribution in parallel
  
  Parameters
  ----------
  n_task : `int`
      Number of task that will be run
  
  n_workers : `int`
      Number of workers that will be used.
      If it is set to None the maximum number of workers will be used.
      Otherwise this number of processes will be created (in case of
      multiprocessing) or work will be executed sequestially (in case
      of threading)
  
  wait_time : `float`
      Time that will be waited on each thread after random number
      simulation
  
  parallelization_type : `string`
      How work will be parallelized : either using multiprocessing or
      using threading
docstr_tok: ["This","function","generates","samples","of","uniform","distribution","in","parallel","Parameters","--","--","--","--","--","n_task",":","`","int","`","Number","of","task","that","will","be","run","n_workers",":","`","int","`","Number","of","workers","that","will","be","used",".","If","it","is","set","to","None","the","maximum","number","of","workers","will","be","used",".","Otherwise","this","number","of","processes","will","be","created","(","in","case","of","multiprocessing",")","or","work","will","be","executed","sequestially","(","in","case","of","threading",")","wait_time",":","`","float","`","Time","that","will","be","waited","on","each","thread","after","random","number","simulation","parallelization_type",":","`","string","`","How","work","will","be","parallelized",":","either","using","multiprocessing","or","using","threading"]
code: def _generate_samples_in_parallel(
      self,
      n_task=10,
      n_workers=None,
      wait_time=0,
      parallelization_type="multiprocessing",
  ):
      """This function generates samples of uniform distribution in parallel
  
      Parameters
      ----------
      n_task : `int`
          Number of task that will be run
  
      n_workers : `int`
          Number of workers that will be used.
          If it is set to None the maximum number of workers will be used.
          Otherwise this number of processes will be created (in case of
          multiprocessing) or work will be executed sequestially (in case
          of threading)
  
      wait_time : `float`
          Time that will be waited on each thread after random number
          simulation
  
      parallelization_type : `string`
          How work will be parallelized : either using multiprocessing or
          using threading
      """
      sample_size = self.stat_size
      args = [(sample_size, wait_time) for _ in range(n_task)]
  
      if parallelization_type == "multiprocessing":
          with Pool(processes=n_workers) as pool:
              samples = pool.starmap(test_uniform_threaded, args)
  
          samples = np.array(samples)
  
      elif parallelization_type == "threading":
  
          class UniformThread(threading.Thread):
              def __init__(self, sample_size, wait_time):
                  super(UniformThread, self).__init__()
                  self.sample_size = sample_size
                  self.wait_time = wait_time
                  self.sample = None
  
              def run(self):
                  self.sample = test_uniform_threaded(
                      self.sample_size, self.wait_time
                  )
  
          if n_workers is None:
              threads = []
              for arg in args:
                  threads.append(UniformThread(*arg))
  
              [t.start() for t in threads]
              [t.join() for t in threads]
              samples = np.array([t.sample for t in threads])
  
          else:
              samples = np.array(
                  [test_uniform_threaded(*arg) for arg in args]
              )
      else:
          raise ValueError("Unknown thread type")
  
      return samples
  
imports: import unittest
  import multiprocessing
  from multiprocessing.pool import Pool
  import itertools
  import numpy
  import threading
  from scipy import stats
  from tick.random import test_uniform, test_gaussian, test_poisson, test_exponential, test_uniform_int, test_discrete, test_uniform_threaded
label_desc: Use image node_id 12 for calling the Test obj's underlying member method code with example usage: obj._generate_samples_in_parallel(n_task, n_workers, wait_time, parallelization_type) and returns: samples