refactor Vec class, fix random