
i = 0;
}</BUG>
StorageDir dir = storageDirs[i];
<BUG>if (dir.getAvailableBytes() >= requestSizeBytes) {
availableDir = dir;
if (availableDir.requestSpace(userId, requestSizeBytes)) {

break;
}</BUG>
}

import java.util.Random;
import tachyon.worker.hierarchy.StorageDir;
public class AllocateRandom extends AllocateStrategyBase {
private Random mRandm = new Random(System.currentTimeMillis());
@Override
public StorageDir getStorageDir(StorageDir[] storageDirs, long userId, long requestBytes) {
int i = mRandm.nextInt(storageDirs.length);
for (int j = 0; j < storageDirs.length; j ++, i ++) {
i = i % storageDirs.length;
StorageDir dir = storageDirs[i];
if (dir.getAvailableBytes() >= requestBytes) {
if (dir.requestSpace(userId, requestBytes)) {
return dir;
