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

Paul Bignier paul.bignier at scilab-enterprises.com
Wed Jun 11 08:41:37 CEST 2014


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 at 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




More information about the users mailing list