Some help with random numbers

Some code for random numbers

package com.generaluse

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows

import java.text.SimpleDateFormat

import internal.GlobalVariable

public class RandomNumber {
	@Keyword
	def CreateRandomNumber() {
		String address = new Random().nextInt(99999 - 1 + 1)
		return (address)
	}

	@Keyword
	def changedatetime(int inp_MinutefromToday, int inp_HourfromToday, int inp_DatefromToday, int inp_MonthfromToday,int inp_YearfromToday,String strDatenowfromDatePicker){
		String newDate = new Date().format('dd/MM/YYY')
		def Todayd = new SimpleDateFormat("dd/MM/YYY")
		Date Today =  Todayd.parse(newDate)

		use (groovy.time.TimeCategory){
			//	KeywordLogger log = new KeywordLogger()
			//def today = input.parse("MM-dd-yyyy", startTime)
			Date out_DatefromToday = Today


			out_DatefromToday = Today + inp_MinutefromToday.minutes + inp_HourfromToday.hours + inp_DatefromToday.days + inp_MonthfromToday.months + inp_YearfromToday.years
			System.out.println(out_DatefromToday)
			String Currentdate = out_DatefromToday.toString()
			def Currentdateparse = new SimpleDateFormat("EE MMM dd HH:mm:ss z yyyy",Locale.ENGLISH)
			def CurrentDateAdjusted = Currentdateparse.parse(Currentdate)
			System.out.println(CurrentDateAdjusted)
			def sdff = new SimpleDateFormat("dd/MM/YYY")
			def frmDate = sdff.format(CurrentDateAdjusted); // Handle the ParseException here



			return frmDate

		}
	}
}

Just a note for next time you enter code into this forum to put three back ticks, like ``` (found on the same key as the tilde ~) one line above your code and one line below your code. It makes the code easier to read.

1 Like