updated random method