view m-toolbox/classes/+utils/@math/rand.m @ 22:b11e88004fca
database-connection-manager
Update collection.fromRepository
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05)
parents
f0afece42f48
children
line source
+ − % RAND return a random number between r1 and r2
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % DESCRIPTION: RAND return a random number between r1 and r2
+ − %
+ − % CALL: val = rand(r1, r2)
+ − %
+ − % INPUTS: r1 - lower limit of the random values
+ − % r2 - upper limit of the random values
+ − %
+ − % OUTPUTS: val - random numbers
+ − %
+ − % VERSION: $Id: rand.m,v 1.2 2008/10/24 06:19:23 hewitson Exp $
+ − %
+ − % HISTORY: 26-01-2007 M Hewitson
+ − % Creation
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ −
+ − function val = rand(r1, r2)
+ −
+ − int = r2-r1;
+ − rand('twister',sum(100*clock));
+ − val = r1 + int*rand;
+ −
+ − end
+ − % END
+ −