From 9e4323bcefadc5f87b3689b57d3667815e87caae Mon Sep 17 00:00:00 2001 From: Luigi Gubello Date: Mon, 31 Aug 2020 15:31:55 +0200 Subject: [PATCH] Adding range choice for setRandomPort() --- NTPClient.cpp | 4 ++-- NTPClient.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/NTPClient.cpp b/NTPClient.cpp index ddb76fb..caa30d1 100755 --- a/NTPClient.cpp +++ b/NTPClient.cpp @@ -204,7 +204,7 @@ void NTPClient::sendNTPPacket() { this->_udp->endPacket(); } -void NTPClient::setRandomPort() { +void NTPClient::setRandomPort(long minValue, long maxValue) { randomSeed(analogRead(0)); - this->_port = random(1, 65534); + this->_port = random(minValue, maxValue); } \ No newline at end of file diff --git a/NTPClient.h b/NTPClient.h index 6498e82..226f54a 100755 --- a/NTPClient.h +++ b/NTPClient.h @@ -47,7 +47,7 @@ class NTPClient { /** * Set random local port */ - void setRandomPort(); + void setRandomPort(long minValue, long maxValue); /** * Starts the underlying UDP client with the default local port