How I generate a random number between 300 and 450?

Z
zeezo · Apr 23, 2022 · 2K views
Question
Hi   I would like to generate a number between 300 and 450.   I also would like which is the possible ways to generate numbers on Matlab? Is there a Poisson generator for random numbers?   And what does the initial seed mean?
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Nov 20, 2025
You can create a "truncated" Poisson distribution that is based on the regular Poisson distribution, but with its range truncated to a given interval and its probability density function (PDF) adjusted so that the distribution remains a proper one (i.e., its integral over the truncation range equals 1).
 
For example, to generate numbers in the range [300, 450] from a truncated Poisson distribution, you could use
 
 
% Regular Poisson distribution
lambda = (300+450)/2; % To put the mean in the middle of the range
d = makedist('poisson', 'lambda', lambda)

% Truncated Poisson distribution
td = d.truncate(300, 450)
td.random(10,1) % Generate 10 random numbers in the range [300 450]

 

Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!