[BUILD] Randomization script refactoring

1) Refactored randomization logic to the top
2) Add logics to support window platforms
This should be `assert_equal x, test_object.working_directory`. As in previous line, the failed assertion has much more informative message then.