source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/missing-data/diff_rand_ints.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 525 bytes
Line 
1function y = diff_rand_ints(ints, n,from,to)
2%  Add n ints, randomly chosen between from and to inclusive to the list in ints.
3%  The resulting vector of ints should have all different numbers.
4if (to + 1 - from) < n + size(ints,2)
5  error(sprintf('Not enough room for %d random numbers from %d to %d', n, from, to));
6end
7for i = 1:n
8  x = random_int(from,to-size(ints,2));
9  oldx = from - 1;
10  while oldx < x
11    temp = x;
12    x = x + sum((oldx < ints) & (ints <= x));
13    oldx = temp;
14  end
15  ints = [ints,x];
16end
17y = ints;
Note: See TracBrowser for help on using the repository browser.