function bnet = randomize_params(bnet, seed)
% RANDOMIZE_PARAMS Set the parameter values of all the adjustable nodes to random values.
% 
% BNET = RANDOMIZE_PARAMS(BNET, SEED) sets the parameter values of all the adjustable nodes to
% random values. This is useful for ensuring that different learning algorithms start from the
% same point in parameter space.

rand('state', seed);
randn('state', seed);
for i=1:length(bnet.bnodes)
  if bnet.bnodes{i}.adjustable
    bnet.bnodes{i} = randomize_params_bnode(bnet.bnodes{i});
  end
end

bnet = compile_params(bnet);
