For dim = 2, $p_{2,1}$
  ($\sin(\theta)$)
  is generated from Unif(0, 1) and the rest computed as follows:
  $p_{1,1} = p_{2,2} = \sqrt{1 - p_{2,1}^2}$
  ($\cos(\theta)$) and
  $p_{1,2} = -p_{2,1}$
  ($-\sin(\theta)$).  For dim $>$ 2, the matrix $\boldsymbol{P}$ is generated
  in the following steps:
  
  1) Generate a $p\times p$ matrix $\boldsymbol{A}$ with
  independent Unif(0, 1) elements and check whether $\boldsymbol{A}$
  is of full rank $p$.
  2) Computes a QR decomposition of $\boldsymbol{A}$, i.e.,
  $\boldsymbol{A} = \boldsymbol{Q}\boldsymbol{R}$ where
  $\boldsymbol{Q}$ satisfies
  $\boldsymbol{Q}\boldsymbol{Q}' = \boldsymbol{I}$,
  $\boldsymbol{Q}'\boldsymbol{Q} = \boldsymbol{I}$,
  $\mbox{det}(\boldsymbol{Q}) = (-1)^{p+1}$,
  and columns of $\boldsymbol{Q}$ spans the linear space generated by
  the columns of $\boldsymbol{A}$.
  3) For odd dim, return matrix $\boldsymbol{Q}$. For even
  dim, return corrected matrix $\boldsymbol{Q}$ to satisfy the
  determinant condition.