Master123的个人博客分享 http://blog.sciencenet.cn/u/Master123

博文

randperm 随机排列

已有 3035 次阅读 2013-4-11 10:30 |个人分类:Matlab|系统分类:科研笔记| randperm

randperm Random permutation.

   P = randperm(N) returns a vector containing a random permutation of the

   integers 1:N.  For example, randperm(6) might be [2 4 5 6 1 3].

   P = randperm(N,K) returns a row vector containing K unique integers

   selected randomly from 1:N.  For example, randperm(6,3) might be [4 2 5].

   

   randperm(N,K) returns a vector of K unique values.  This is sometimes

   referred to as a K-permutation of 1:N or as sampling without replacement.

   To allow repeated values in the selection, sometimes referred to as

   sampling with replacement, use RANDI(N,1,K).

   randperm calls RAND and therefore changes the state of the random number

   generator that underlies RAND, RANDI, and RANDN.  Control that shared

   generator using RNG.




https://blog.sciencenet.cn/blog-783294-679149.html

上一篇:秒的国际定义
下一篇:国际科技数据委员会(CODATA)基本物理常数推荐值(2010)
收藏 IP: 58.240.39.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-17 13:30

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部