Hello, I have the doubt of how big is the data string that will generate the random() function in my code, but in my research I have not found this information, could someone help me with that?
From the Arduino Reference page:
Description
The random function generates pseudo-random numbers.
Syntax
random(max)
random(min, max)
Parameters
min: lower bound of the random value, inclusive (optional).
max: upper bound of the random value, exclusive.
Returns
A random number between min and max-1. Data type: long.
Data type: **long**.
Are you talking about the standard Arduino random() function? I assume that must be what you mean, because if you made your own version of random(), you would not ask the forum for the answer without posting the code. Or would you?
The Arduino random() function does not generate a string. It generates an integer number, which is of type long, as mentioned by @JohnRob .
If your code converts this number to a string, in decimal representation, the length could be maximum 10. But if you use parameters, for example random(99) then if converted to a string this would be only maximum length 2.
mmmmm. what "string"?
A long is 32-bits.
It will always return a type long but in most applications the range will be constrained. It's rare that you'd want to pick a random number out of a couple billion possibilities.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.