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