语法
void randomSeed(unsigned int seed)
参数
seed 随机数种子,不能为0
返回值
无
示例
long randNumber;
void setup() {
pinMode(0, INPUT_ANALOG);
randomSeed(analogRead(0));
}
void loop() {
randNumber = random(300);
Serial.println(randNumber);
delay(50);
}