From 01bffd11c0c81cc28568d15106b1514c190b5777 Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 15 Dec 2017 19:50:34 -0800 Subject: [PATCH] Add note about max parameter to random() reference page See: https://github.com/arduino/reference-en/pull/285 --- Language/Functions/Random Numbers/random.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Language/Functions/Random Numbers/random.adoc b/Language/Functions/Random Numbers/random.adoc index 88e9e58..39d7e25 100644 --- a/Language/Functions/Random Numbers/random.adoc +++ b/Language/Functions/Random Numbers/random.adoc @@ -86,5 +86,7 @@ If it is important for a sequence of values generated by `random()` to differ, o Conversely, it can occasionally be useful to use pseudo-random sequences that repeat exactly. This can be accomplished by calling `randomSeed()` with a fixed number, before starting the random sequence. +The `max` parameter should be chosen according to the data type of the variable in which the value is stored. In any case, the absolute maximum is bound to the `long` nature of the value generated (32 bit - 2,147,483,647). Setting `max` to a higher value won't generate an error during compilation, but during sketch execution the numbers generated will not be as expected. + -- // HOW TO USE SECTION ENDS