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

TAN TH tanthiamhuat at yahoo.com
Wed Jun 11 08:44:05 CEST 2014


yes, I got it already, thanks a lot.




On Wednesday, 11 June 2014, 14:42, Paul Bignier <paul.bignier at 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 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

_______________________________________________
users mailing list
users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140610/51253340/attachment.htm>


More information about the users mailing list