The initial velocities are drawn from a Gaussian distribution with variance $$\sigma_i^2=\frac{k_{\textrm{B}}T}{m_i},$$ where $k_{\textrm{B}}$ denotes Boltzmann's constant, $T$ is the temperature and $m_i$ is the mass of the $i^{\textrm{th}}$ particle.
Thus, the problem boils down to generate random numbers from a gaussian distribution using uniformly distributed random numbers. This is fortunately quite simple: the Wikipedia article <https://en.wikipedia.org/wiki/Box–Muller_transform> shows some very common algorithms how to transform uniform random numbers into gaussian random numbers.
Let's put everything together: every component of the velocity of the $i^{\textrm{th}}$ particle is computed via $$v_i=\sqrt{\frac{k_{\textrm{B}}T}{m_i}}\,\mathcal{N}(0,1),$$$$v_{i,\alpha}=\sqrt{\frac{k_{\textrm{B}}T}{m_i}}\,\mathcal{N}(0,1)\,,\quad\alpha\in\{x,y,z\}\,,$$ where $\mathcal{N}(0,1)$ is a gaussian random number with variance 1 and mean 0.
In case of vectorial velocitiesWith this definition, initialise all components of each particle's velocity vector with this scheme, and remember to usecomponent follows a new gaussian random number for each componentdistribution $$\pi(v_\alpha)\textrm{d}v_\alpha\propto\exp\left(-\frac{v_\alpha^2}{2\sigma^2}\right)\textrm{d}v_\alpha\,,$$ but when you write the distribution of the velocity vector in spherical coordinates and integrate the angular components, you obtain $$\pi(v)\textrm{d}v \propto v^2\exp\left(-\frac{v^2}{2\sigma^2}\right)\textrm{d}v\,,$$ which is the desired Maxwell-Boltzmann distribution.