Code example for Random

0
public class ConfigUpdater { 
   
  public static final String PATH = "/config";
   
  private ActiveKeyValueStore store;
  private Random random = new Random();
   
  public ConfigUpdater(String hosts) throws IOException, InterruptedException {
    store = new ActiveKeyValueStore();
    store.connect(hosts);
  } 
   
  public void run() throws InterruptedException, KeeperException { 
    while (true) { 
      String value = random.nextInt(100) + "";
      store.write(PATH, value);
      System.out.printf("Set %s to %s\n", PATH, value);
      TimeUnit.SECONDS.sleep(random.nextInt(10));
    } 
  } 
Contextual code suggestions in your IDE  Get Codota for Java