我是靠谱客的博主 优美店员,最近开发中收集的这篇文章主要介绍matlab randi 函数,急求MATLAB的randi函数源代码,我的7.1没有,谢谢谢谢,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

满意答案

00e27ab806e4881f8254fe7ae8741834.png

cowboy823

2014.03.08

00e27ab806e4881f8254fe7ae8741834.png

采纳率:57%    等级:12

已帮助:6451人

%RANDI Pseudorandom integers from a uniform discrete distribution.

% R = RANDI(IMAX,N) returns an N-by-N matrix containing pseudorandom

% integer values drawn from the discrete uniform distribution on 1:IMAX.

% RANDI(IMAX,M,N) or RANDI(IMAX,[M,N]) returns an M-by-N matrix.

% RANDI(IMAX,M,N,P,...) or RANDI(IMAX,[M,N,P,...]) returns an

% M-by-N-by-P-by-... array. RANDI(IMAX) returns a scalar.

% RANDI(IMAX,SIZE(A)) returns an array the same size as A.

%

% R = RANDI([IMIN,IMAX],...) returns an array containing integer

% values drawn from the discrete uniform distribution on IMIN:IMAX.

%

% Note: The size inputs M, N, P, ... should be nonnegative integers.

% Negative integers are treated as 0.

%

% R = RANDI(..., CLASSNAME) returns an array of integer values of class

% CLASSNAME.

%

% The sequence of numbers produced by RANDI is determined by the internal

% state of the uniform pseudorandom number generator that underlies RAND,

% RANDI, and RANDN. RANDI uses one uniform value from that default

% stream to generate each integer value. Control the default stream using

% its properties and methods. See RANDSTREAM for details about the

% default stream.

%

% Resetting the default stream to the same fixed state allows computations

% to be repeated. Setting the stream to different states leads to unique

% computations, however, it does not improve any statistical properties.

% Since MATLAB uses the same state each time it starts up, RAND, RANDN, and

% RANDI will generate the same sequence of numbers in each session unless

% the state is changed.

%

% Examples:

%

% Generate integer values from the uniform distribution on the set 1:10.

% r = randi(10,100,1);

%

% Generate an integer array of integers drawn uniformly from 1:10.

% r = randi(10,100,1,'uint32');

%

% Generate integer values drawn uniformly from -10:10.

% r = randi([-10 10],100,1);

%

% Save the current state of the default stream, generate 5 integer

% values, restore the state, and repeat the sequence.

% defaultStream = RandStream.getDefaultStream;

% savedState = defaultStream.State;

% i1 = randi(10,1,5)

% defaultStream.State = savedState;

% i2 = randi(10,1,5) % contains exactly the same values as i1

%

% Replace the default stream with a stream whose seed is based on CLOCK, so

% RANDI will return different values in different MATLAB sessions. NOTE: It

% is usually not desirable to do this more than once per MATLAB session.

% RandStream.setDefaultStream(RandStream('mt19937ar','seed',sum(100*clock)));

% randi(10,1,5)

%

% See also RAND, RANDN, RANDSTREAM, RANDSTREAM/RANDI, RANDSTREAM.GETDEFAULTSTREAM.

% Copyright 2008 The MathWorks, Inc.

% $Revision: 1.1.6.2 $ $Date: 2008/09/13 06:57:04 $

% Built-in function.

05分享举报

最后

以上就是优美店员为你收集整理的matlab randi 函数,急求MATLAB的randi函数源代码,我的7.1没有,谢谢谢谢的全部内容,希望文章能够帮你解决matlab randi 函数,急求MATLAB的randi函数源代码,我的7.1没有,谢谢谢谢所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(62)

评论列表共有 0 条评论

立即
投稿
返回
顶部