From: Mine on
Hi,

I need to generate 1000 random numbers which are just 1, 2, 3, 4. Is there any way to generate numbers which are just 1, 2, 3, 4?

Thank you very much in advance.

Mine
From: Mark Shore on
"Mine " <taskanmine(a)yahoo.com> wrote in message <ht3biv$m6g$1(a)fred.mathworks.com>...
> Hi,
>
> I need to generate 1000 random numbers which are just 1, 2, 3, 4. Is there any way to generate numbers which are just 1, 2, 3, 4?
>
> Thank you very much in advance.
>
> Mine

a=randi(4,1000,1)

doc randi
From: Jan Simon on
Dear Mine!

> I need to generate 1000 random numbers which are just 1, 2, 3, 4. Is there any way to generate numbers which are just 1, 2, 3, 4?

Yes.
What have you tried so far to solve this homework-like problem?
Do you know the functions CEIL and FLOOR? Can you create 1000 random numbers between 0 and 1?

Jan
From: Mark Shore on
"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <ht3db8$i8n$1(a)fred.mathworks.com>...
> Dear Mine!
>
> > I need to generate 1000 random numbers which are just 1, 2, 3, 4. Is there any way to generate numbers which are just 1, 2, 3, 4?
>
> Yes.
> What have you tried so far to solve this homework-like problem?
> Do you know the functions CEIL and FLOOR? Can you create 1000 random numbers between 0 and 1?
>
> Jan

I'm hoping that wasn't a homework problem but rather a simple question from an inexperienced user working on bigger things...

When I've given assignments myself I made sure there was a certain minimum amount of thinking and creative work required.
From: Mine on
Thank you for your kind responses but the cause of the question is that I do not have randi function, I looked at this from internet and my -help randi - did not give an answer, and in addition i am not a student just a new user who could not find the proper key words in her search and ask question! Thank you very much for your consideration. It was my first question from this web site to try to learn something about a new program myself. And also thank you for encouraging new self-learners who are not students that make homework!!!