function [X] = mkdata(k,n)
%  X = MKDATA(M,N)
%  
%    create a random data set X by drawing N points from each of the M
%    unit-variance Gaussians 
%    Default: M = 2, N = 20
%    Data returned in rows of X.

if (nargin < 2)
  n = 20;
end
if (nargin < 1)
  k = 2;
end

X = [randn(n,2)];

d = 3;
b = 0;
for m=2:k
  X = [X;randn(n,2)+repmat([d,d],n,1)];
  d = -d; b = ~b;
  if (~b)
    d = d+3;
  end
end

