class_docstr: Unit tests for distributions in discrete.py 
class_docstr_tok: ["Unit","tests","for","distributions","in","discrete.py"]
docstr: Tests random sampling from Bernoulli distribution 
docstr_tok: ["Tests","random","sampling","from","Bernoulli","distribution"]
code: def test_random_sampling_bernoulli(self):
      """Tests random sampling from Bernoulli distribution"""
      self.report("Test random sampling of Bernoulli Distribution.")
      p = 0.6
      dist = Bernoulli(p)
      mean = dist.get_mean()
      var = dist.get_variance()
      samples = dist.draw_samples("random", self.size)
      mean_r = self._compute_mean(samples)
      var_r = self._compute_variance(samples)
      self._check_sample_sizes(samples)
      assert abs(mean - mean_r) <= self.threshold
      assert abs(var - var_r) <= self.threshold
      self.report(
          "%s, mean=%0.3f, variance=%0.3f :: test result: mean=%0.3f, "
          "variance=%0.3f" % (str(dist), mean, var, mean_r, var_r),
          "test_result",
      )
  
file_path: dragonfly/dragonfly/distributions/unittest_discrete.py
imports: from __future__ import absolute_import
  import numpy
  from .discrete import Bernoulli, Binomial, DiscreteUniform
  from ..utils.base_test_class import BaseTestClass, execute_tests
label_desc: Use image node_id 5 for calling the DiscreteDistributionsTestCase obj's underlying member method code with example usage: obj.test_random_sampling_bernoulli() without return types