Re: [Scilab-users] Generate 5 unique random integer number between 1 and 10

2014-06-11 Thread Paul Bignier


Hello,

How about taking the five first elements of a permutation of vector 1:10 ?

Random_10 = grand(1, prm, 1:10);
Random_5   = Random_10(1:5)

http://help.scilab.org/docs/5.5.0/en_US/grand.html

Regards,
Paul


On 06/11/2014 05:34 AM, tanthiamhuat wrote:

how do I generate 5 UNIQUE, DISTINCT random integer between 1 and 10?

I try this, but it is not unique.

Random_5=round(rand(1,5)*9)+1



--
View this message in context: 
http://mailinglists.scilab.org/Generate-5-unique-random-integer-number-between-1-and-10-tp4030712.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


--
Paul BIGNIER
Development engineer
---
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.69
http://www.scilab-enterprises.com

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Generate 5 unique random integer number between 1 and 10

2014-06-11 Thread TAN TH
yes, I got it already, thanks a lot.




On Wednesday, 11 June 2014, 14:42, Paul Bignier 
paul.bign...@scilab-enterprises.com wrote:
 



Hello,

How about taking the five first elements of a permutation of vector 1:10 ?

Random_10 = grand(1, prm, 1:10);
Random_5   = Random_10(1:5)

http://help.scilab.org/docs/5.5.0/en_US/grand.html

Regards,
Paul


On 06/11/2014 05:34 AM, tanthiamhuat wrote:
 how do I generate 5 UNIQUE, DISTINCT random integer between 1 and 10?

 I try this, but it is not unique.

 Random_5=round(rand(1,5)*9)+1



 --
 View this message in context: 
 http://mailinglists.scilab.org/Generate-5-unique-random-integer-number-between-1-and-10-tp4030712.html
 Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
 Nabble.com.
 ___
 users mailing list
 users@lists.scilab.org
 http://lists.scilab.org/mailman/listinfo/users

-- 
Paul BIGNIER
Development engineer
---
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.69
http://www.scilab-enterprises.com

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users