From: Derek O'Connor on 5 Apr 2010 10:50 Peter Perkins <Peter.Perkins(a)MathRemoveThisWorks.com> wrote in message <hpcof7$2sp$1(a)fred.mathworks.com>... > On 4/5/2010 1:47 AM, Derek O'Connor wrote: > > > Does RAND return a floating point number in (0,1), (0,1], [0,1), or [0,1]? > > > > What seed(state) for RAND will give 0 or 1? > > > >>> help rand gave me no help on this question. > > In the current release, > > >> help rand > RAND Uniformly distributed pseudorandom numbers. > R = RAND(N) returns an N-by-N matrix containing pseudorandom values drawn > from the standard uniform distribution on the open interval(0,1). > [snip] ---------------------------------------------------------------------- Thanks Peter. My R2008 <help rand> says: > R = RAND(N) returns an N-by-N matrix containing pseudo-random values > drawn from a uniform distribution on the unit interval. > > However, when I read further down I see 3 items: > > 1. This method ('twister') generates double precision values in the closed interval [2^(-53), 1-2^(-53)], with a period of (2^19937-1)/2. > > 2. This method ('state') generates double precision values in the closed interval [2^(-53), 1-2^(-53)], with a period of over 2^1492. > > 3. This method ('seed') generates double precision values in the closed interval [1/(2^31-1), 1-1/(2^31-1)], with a period of 2^31-2. So, 'twister' and state generate DP numbers in [eps/2, 1-eps/2] which gives >> disp([eps/2; 1-eps/2]) % MT and State 1.110223024625157e-016 9.999999999999999e-001 Seed gives >> disp([1/(2^31-1); 1-1/(2^31-1)]) % Seed 4.656612875245797e-010 9.999999995343387e-001 This may be a dumb question, but I'll ask it anyway: can rand's output be modified so that 0 and 1 appear as two extra pseudo-random numbers? Remember, Harish wants [0,1]. Derek O'Connor.
From: Peter Perkins on 5 Apr 2010 11:23 On 4/5/2010 10:50 AM, Derek O'Connor wrote: > This may be a dumb question, but I'll ask it anyway: can rand's output > be modified so that 0 and 1 appear as two extra pseudo-random numbers? > Remember, Harish wants [0,1]. He may. Harish, you did say "in", but perhaps you meant "including the endpoints". There's no flag or setting you can use to get that. Most people do not want those endpoints, because they would mess up things like the inversion method to get a non-uniform distribution.
From: Hatoddyam Toto on 23 Apr 2010 16:17 see this link...might help: http://www.mathworks.com/matlabcentral/newsreader/view_thread/19801 On Apr 23, 3:48 pm, amit sharma <sharma....(a)gmail.com> wrote: > Sir > > i want to make an array of [16*8] random number of [1,16] in which > every column have non repeating number and row elements are not same.
First
|
Prev
|
Pages: 1 2 Prev: loop vs matrix multiplication: speed vs memory Next: Detect noisy points in curve |