How to write "is distributed as" under a certain hypothesis?

The following minimal example provides two possibilities: \distas{<stuff>} and \distras{<stuff>}. The former uses amsmath's \overset{<top>}{<bottom>} which sets <top> over top of <bottom>. The latter uses a resized version of <bottom> in case <top> is wider than <bottom>. In fact, it stretches <bottom> to 6pt wider than <top> (3pt on either side). In both instances, <bottom> is fixed to \sim and the symbol is spaced as a binary operator via \mathbin.

enter image description here

\documentclass{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\makeatletter
\newcommand{\distas}[1]{\mathbin{\overset{#1}{\kern\z@\sim}}}%
\newsavebox{\mybox}\newsavebox{\mysim}
\newcommand{\distras}[1]{%
  \savebox{\mybox}{\hbox{\kern3pt$\scriptstyle#1$\kern3pt}}%
  \savebox{\mysim}{\hbox{$\sim$}}%
  \mathbin{\overset{#1}{\kern\z@\resizebox{\wd\mybox}{\ht\mysim}{$\sim$}}}%
}
\makeatother
\begin{document}

$X\distas{H_0}Y \quad X\distras{H_0}Y$
\end{document}

\stackrel{H_0}{\sim} works for me.

Result:

enter image description here