How to randomly set values for the data type 'Date Time' in the Programmable Device Simulator

How to randomly set values for the data type 'Date Time' in the Programmable Device Simulator for device connections?

This script seems to work:

import random
from datetime import datetime, timedelta
startDate = datetime(2023, 1, 1)
endDate = datetime(2023, 12, 31)
randomDate = startDate + timedelta(days=random.randint(0, (endDate - startDate).days))
print randomDate

Outputs:

2023-01-14 00:00:00
2023-08-27 00:00:00
2023-08-08 00:00:00
2023-03-03 00:00:00
2023-04-15 00:00:00

My apologies for the delayed response.
It is working with the Gateway Event Script.
Thank you for the explanation.