public CacheSerializableRunnable getCacheSerializableRunnableForPRRandomOps(
      final String regionName, final int from, final int to) {
    SerializableRunnable prPuts = new CacheSerializableRunnable("PRPuts") {
      @Override
      public void run2() throws CacheException {
        Cache cache = getCache();
        Region region = cache.getRegion(regionName);

        for (int i = 0; i < 3; i++) {
          for (int j = from; j < to; j++) {
            int op = new Random().nextInt(4);
            try {
              switch (op) {
                case 0:
                  // Put operation
                  region.put(j, new Portfolio(j));
                  break;
                case 1:
                  // invalidate
                  if (region.containsKey(j)) {
                    region.invalidate(j);
                  }
                  break;
                case 2:
                  if (region.containsKey(j)) {
                    region.destroy(j);
                  }
                  break;
                case 3:

                  if (!region.containsKey(j)) {
                    region.create(j, null);
                  }

                  break;
                default:
                  break;
              }
            } catch (EntryExistsException e) {
              // Do nothing let it go
              LogWriterUtils.getLogWriter()
                  .info("EntryExistsException was thrown for key " + j);
            } catch (EntryNotFoundException e) {
              // Do nothing let it go
              LogWriterUtils.getLogWriter()
                  .info("EntryNotFoundException was thrown for key " + j);
            }
          }
        }
      }
    };
    return (CacheSerializableRunnable) prPuts;
  }
This function puts portfolio objects into the created Region (PR or RR). Also, other operation
like, invalidate, destroy and create are performed in random manner based on
{@link Random#nextInt(int)}.

@return cacheSerializable object
geode-core/src/distributedTest/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java