const int ledPin = 3; unsigned long now = 0; unsigned long timerB = 0; void setup() { pinMode(ledPin, OUTPUT); now = millis(); timerB = now + 100; } void loop() { // put your main code here, to run repeatedly: now = millis(); if ( now > timerB ) { analogWrite(ledPin, rnd128() + 100); timerB = now + rnd128() + 30; } } uint8_t rnd128(void) { static uint8_t s = 0xaa, a = 0; s ^= s << 3; s ^= s >> 5; s ^= a++ >> 2; return s >> 1; }