Gen functions

Can you give this a once over, i remember the last time I made some pretty silly mistakes.
This doesn't really matter, but you might want to use `uniform` here instead of the random seed.