I need to generate random numbers with following properties.
If the distribution is not important and all you're interested in is the mean, then there's a particularly simple function that does that:
function x=myrand x=6; end