generateViewId static method

int generateViewId()

Generates a unique view ID based on the current time with an added random factor.

This function creates a view ID by combining the current timestamp (in milliseconds) with a random number between 0 and TIME_TO_USE_AS_FACTOR_IN_VIEW_ID_CREATION. This approach helps avoid creating duplicate view IDs when called in quick succession.

Returns: A Int representing the generated view ID.

Implementation

static int generateViewId() {
  return DateTime.now().millisecondsSinceEpoch + random.nextInt(TIME_TO_USE_AS_FACTOR_IN_VIEW_ID_CREATION);
}