Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: k (3) Vectors of ones and zeros "combining" together
Date: Thu, 19 Jan 2012 18:28:10 +0000 (UTC)
Organization: Xoran Technologies
Lines: 23
Message-ID: <jf9nbq$b9h$1@newscl01ah.mathworks.com>
References: <jf510f$nv5$1@newscl01ah.mathworks.com> <jf51ot$q13$1@newscl01ah.mathworks.com> <jf5309$a8$1@newscl01ah.mathworks.com> <jf6n35$3kn$1@newscl01ah.mathworks.com> <jf71oe$bbi$1@newscl01ah.mathworks.com> <jf7l1a$h8i$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1326997690 11569 172.30.248.46 (19 Jan 2012 18:28:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 19 Jan 2012 18:28:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:755181

"Apostol" wrote in message <jf7l1a$h8i$1@newscl01ah.mathworks.com>...
>
> > Forget it. I now realize that my approach is equivalent to Roger's...
> 
> 
> Thank you very much guys! For small values of N this shouldn't be a problem, given that for my specific problem some groups have the same "value" of others... if it'll get tougher with a higher N perhaps I should consider other options. 
===================

Below is a method which I really do believe should give uniformly distributed results, but  for some reason it is giving me some weird outliers in my histogram plots for N=5 and 1e6 samples. Possibly 1e6 is still insufficient...?


sets=nchoosek(1:N-1,2);
M=size(sets,1);
thisSet=sets(randi(M),:);
len1=thisSet(1);
len2=thisSet(2)-thisSet(1);
len3=N-(len1+len2);

A=[repmat([1;0;0],1,len1),...
   repmat([0;1;0],1,len2),...    
   repmat([0;0;1],1,len3)];  

A=A(:,randperm(N));