Code example for Random

0
import java.io.InputStream; 
import java.io.OutputStream; 
import java.util.Random; 
 
public final class FileLruCacheTests extends AndroidTestCase {
    private static final Random random = new Random();
 
    @SmallTest @MediumTest @LargeTest 
    public void testCacheOutputStream() throws IOException { 
        int dataSize = 1024;
        byte[] data = generateBytes(dataSize);
        String key = "a";
 
        // Limit to 2x to allow for extra header data 
        FileLruCache cache = new FileLruCache(getContext(), "testCacheOutputStream", limitCacheSize(2*dataSize));
 
        put(cache, key, data);
        checkValue(cache, key, data);
        cache.clearForTest();
    }