const int sides=2;
void setup() {
Serial.begin(115200);
Serial.print("Hit Enter to roll a d");
Serial.println(sides);
}
void loop() {
while (Serial.available()) {
int ch = Serial.read();
if (ch == '\n') {
randomSeed(random() + micros()); // Add entropy from keypress
Serial.print(random(1, sides+1));
Serial.print(',');
}
}
}