class_docstr: This class tests all member functions of crypten package
class_docstr_tok: ["This","class","tests","all","member","functions","of","crypten","package"]
docstr: Tests uniform random variable generation on [0, 1)
code: def test_rand(self):
      """Tests uniform random variable generation on [0, 1)"""
      for size in [(10,), (10, 10), (10, 10, 10)]:
          randvec = crypten.rand(*size)
          self.assertTrue(randvec.size() == size, "Incorrect size")
          tensor = randvec.get_plain_text()
          self.assertTrue(
              (tensor >= 0).all() and (tensor < 1).all(),
              "Invalid values",
          )
  
      randvec = crypten.rand(int(1e6)).get_plain_text()
      mean = torch.mean(randvec)
      var = torch.var(randvec)
      self.assertTrue(
          torch.isclose(mean, torch.tensor([0.5]), rtol=1e-3, atol=1e-3)
      )
      self.assertTrue(
          torch.isclose(
              var, torch.tensor([1.0 / 12]), rtol=1e-3, atol=1e-3
          )
      )
  
imports: import itertools
  import logging
  import math
  import random
  import unittest
  from collections import defaultdict
  import crypten
  import crypten.communicator
  import torch
  import torch.nn.functional
  from crypten.common import serial
  from crypten.common.tensor_types import is_float_tensor
  from crypten.config import cfg
  from test.multiprocess_test_case import get_random_test_tensor, MultiProcessTestCase
  from torch import nn
label_desc: Use image node_id 8 for calling the TestCrypten obj's underlying member method code with example usage: obj.test_rand() without return types