refactor correlation and random source