# RandomVariate form a Specific Distribution with Restrictions

There are a lot of questions about generating random numbers form both uni-variate and bi-variate distributions. Mathematica has a lot of built in distributions for that purpose. However, I could not do what I wanted to do. I am looking for help.

I want to generate random numbers using built in Mathematica distribution but would like to put some restriction. For example, the following code gives me 2000 random numbers form exponential distribution.

example1=RandomVariate[ExponentialDistribution[0.0067], 2000];

However, I am trying to get 2000 random variables greater than say 20 from exponential distribution. Similarly, the following code gives me 2000 random numbers a form Farlie-Gumbel-Morgenstern copula.

example2=RandomVariate[
ExponentialDistribution[0.0067]}], 2000];

However, I want to get 2000 random numbers form Normal distribution between -.02 and .02 or I want random numbers form exponential distribution between 40 and 1000.

Any help is greatly appreciated. Thank you in advance.

=================

2

TruncatedDistribution may be what you are after.
– Andy Ross
Dec 18 ’14 at 1:28

@ Andy, you are right. But I am also expecting some innovative answers, which I always get form this community.
– ramesh
Dec 18 ’14 at 2:19

=================

1

=================

d1 = RandomVariate[ExponentialDistribution[.1], 2000];
d2 = RandomVariate[TruncatedDistribution[{20, 40}, ExponentialDistribution[.1]], 2000];

GraphicsColumn[{Histogram[d1, {1}, PlotRange -> {{0, 72}, {0, 250}}],
Histogram[d2, {1}, PlotRange -> {{0, 72}, {0, 250}}, AxesOrigin -> {0, 0}]}]

@ belisarius thank you for taking time to answer my question. This proves that I am a new user of Mathematica. However, I am expecting some more answers so I can play with. Thanks again.
– ramesh
Dec 18 ’14 at 2:17

@rka Feeling comfortable with mathematica takes some time. Be patient and keep trying
– Dr. belisarius
Dec 18 ’14 at 2:38