Date: Jul 14, 2013 4:30 AM
Author: Antonio Valentine
Subject: Re: generate specific random value except some numbers

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <krtmb3$1gq$1@newscl01ah.mathworks.com>...
> A = [1:40];
> B = [10 13 22 27];
>
> left=[A(1) B+1];
> right=[B-1 A(end)];
> n = right-left+1;
> e = [0 cumsum(n)];
> a = floor(e(end)*rand(1,1e5));
> [~, d] = histc(a, e);
> r = a+d+A(1)-1;
>
> % Bruno


It's quite complicated but it is working perfectly.

Thanksss Bruno. :)