You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: spm_kmeans.m
    path of file: ./repos/spm/toolbox/mixture
    
    the code of the file until where you have to start completion: function [priors,means,covs,post] = spm_kmeans (y,k,method,return_cov)
% K-means clustering
% FORMAT [priors,means,covs,post] = spm_kmeans (y,k,method,return_cov)
%
% y             [N x d] data matrix containing N samples of d-dim data
% k             number of clusters

    
function [priors,means,covs,post] = spm_kmeans (y,k,method,return_cov)
% K-means clustering
% FORMAT [priors,means,covs,post] = spm_kmeans (y,k,method,return_cov)
%
% y             [N x d] data matrix containing N samples of d-dim data
% k             number of clusters
% method        'uniform', 'points' or 'random' (default) seeding
% return_cov    Set to 1 to return class covariances. Zero otherwise.
%               (default is 1).
%
% priors        [1 x k] vector of class prior probabilities
% means         [k x d] matrix of class means
% covs          [d x d x k] matrix containing class covariances. This
%               matrix is empty if return_covs=0
% post          [N x k] matrix of class labels
%__________________________________________________________________________

% Will Penny 
% Copyright (C) 2007-2022 Wellcome Centre for Human Neuroimaging


if nargin < 3 || isempty(method)
   method='random';
end