Create a random file if path is a directory

As part of GRUNT config for our project we run multiple test suites. Current implementation overrides the file created by previous test suite. This change will create one file per test suite.