fix srand v1 correctness
reduce global mem use