class_docstr: RNG that produces same outputs as torch.randn(..., device='cuda') on CPU
docstr: Generate a sequence of n standard normal random variables using the Philox 4x32 random number generator and the Box-Muller transform.
docstr_tok: ["Generate","a","sequence","of","n","standard","normal","random","variables","using","the","Philox","4x32","random","number","generator","and","the","Box-Muller","transform","."]
code: def randn(self, shape):
      """Generate a sequence of n standard normal random variables using the Philox 4x32 random number generator and the Box-Muller transform."""
  
      n = 1
      for x in shape:
          n *= x
  
      counter = np.zeros((4, n), dtype=np.uint32)
      counter[0] = self.offset
      counter[2] = np.arange(
          n, dtype=np.uint32
      )  # up to 2^32 numbers can be generated - if you want more you'd need to spill into counter[3]
      self.offset += 1
  
      key = np.empty(n, dtype=np.uint64)
      key.fill(self.seed)
      key = uint32(key)
  
      g = philox4_32(counter, key)
  
      return box_muller(g[0], g[1]).reshape(shape)
  
imports: import numpy
label_desc: Use image node_id 2 for calling the Generator obj's underlying member method code with example usage: obj.randn(shape) and returns: box_muller