updated prims test to include random factor