[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rand implementation question

From: mpender
Subject: Re: Rand implementation question
Date: Tue, 4 Mar 2014 10:22:43 -0800 (PST)

Actually, it looks like randi may suffer from the same problem.  I found a
link for what appears to be the */randi/* code for Octave:

The line which computes the random integers is apparently:
ri = imin + floor ( (imax-imin+1)*rand (varargin{:}) );

Since it relies on */rand/* to generate the random values, then if */rand/*
occasionally takes on the value 1.0:
ri = imin + floor ((imax - imin + 1) * 1.0)
ri = imin + imax - imin + 1
ri = imax + 1

Of course, it is possible that the code has been changed since this was
posted.  The copyright date is from 2012 and it was not found on the Octave
Forge web site.

View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]