This is sort of an odd question, I realize - but it has to do with random number generation. What I'd like to do is generate random numbers with a normal distribution; many functions (in Python) do this already as long as you give the function a mean and standard deviation. Note also that to generate uniform random variables you must specify a range, e.g. a random number between $i$ and $j$.
I'm in the situation where I need to generate both uniform random numbers in the range $[i,j]$ as well as normally distributed numbers in that range (or at least such that 98% of the random numbers fit into that range). Computing the mean of the uniform distribution is not difficult, so now I have a mean and a range - but I need the final parameter, the standard deviation in order to generate all my random numbers.
So my initial thought is that we can use the following to compute the standard deviation: $\sigma = \frac{j - \mu}{3}$ and or $\sigma = \frac{i - \mu}{-3}$. This seems to work fairly well, for a range $[50, 150]$, it gives me $\mu=100$ and $\sigma=16.666667$ which looks like this:
Though perhaps even this is still too long of a curve for the distribution? I'd like some advice if this approach is close to correct, or if there is a more official way to compute this - maybe even a way to generalize the computation for various confidence intervals/z-scores (I know I should have probably chosen 2.333 for 98%).
Another generalization that would be very helpful is if I don't have a range but rather a width, (the width was 100 in the previous example) can I generalize the standard deviation for that width given any $\mu$?