// Generate Random Number - purwarupa3D

const byte Button_Pin = 2;      
const int delay_Debounce = 50;  

int lastbuttonState = LOW;      
int lastFlickableState = LOW;  
int reading;                    

unsigned long lastDebounceTime = 0;   
unsigned long startTimer;             

void setup() {

Serial.begin(9600);
pinMode (Button_Pin,INPUT);
randomSeed(analogRead(0));

}

void loop() {
reading = digitalRead(Button_Pin); 
int randomNumber = random(100);

if (reading != lastFlickableState) {  
  lastDebounceTime = millis();
  lastFlickableState = reading;       
}

startTimer = millis();
if ((startTimer - lastDebounceTime) > delay_Debounce) {   
  if(lastbuttonState == LOW && reading == HIGH)
    Serial.println (randomNumber);
  lastbuttonState = reading;
}
}