fixed randomise function call