code: def generate_uniform_direction(d, massmatrix):
      """Draw unit direction vector according to mass matrix."""
      momentum = np.random.multivariate_normal(
          np.zeros(d), np.dot(massmatrix, np.eye(d))
      )
      momentum /= (momentum**2).sum() ** 0.5
      return momentum
  
file_path: ultranest/ultranest/dychmc.py
imports: from __future__ import print_function, division
  import numpy
  import matplotlib.pyplot
label_desc: Use image node_id 5 for calling a global function with example usage: generate_uniform_direction(d, massmatrix) and returns: momentum