import random


def setRandomParameters(net,seed=None,randFunc=random.random):
    """
    Sets parameters to random values given by the function randFunc (by
    default, uniformly distributed on [0,1) ).
    """
    random.seed(seed)
    net.setOptimizables( randFunc(len(net.GetParameters())) )
    return net.GetParameters()