/usr/share/psychtoolbox-3/PsychProbability/Ranint.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | function i = Ranint(dim,n)
% i = Ranint([dim],n)
%
% Choose "dim" random integers in the range 1:n.
%
% For historical reasons, the usage is a little weird. If you omit the dim
% argument, then a single random integer is drawn from the range 1:n.
%
% Also see Randi.
% 4/10/94 dhb Added optional first argument.
% 8/19/94 dhb Clarified comment.
% 1/20/97 dhb Delete obsolete rand('uniform').
% 4/12/99 dgp Changed names of arguments to be consistent with Matlab and Randi.
% 7/24/04 awi Cosmetic.
if nargin == 1
n = dim;
dim = 1;
end
list = rand(dim,1);
i = floor( n .* list ) + 1;
|