[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:
http://addi.googlecode.com/svn-history/r190/Addi/assets/m/general/randi.m
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:
http://octave.1599824.n4.nabble.com/Re-Rand-implementation-question-tp4662472p4662705.html
Sent from the Octave - General mailing list archive at Nabble.com.