You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include <Arduino.h>
|
|
#include <stdint.h>
|
|
#include "picker.h"
|
|
|
|
Picker::Picker() {
|
|
val = random(1, 256);
|
|
}
|
|
|
|
bool Picker::Pick(uint8_t likelihood) {
|
|
if ((val > 0) && (val <= likelihood)) {
|
|
val = 0;
|
|
return true;
|
|
}
|
|
val -= likelihood;
|
|
return false;
|
|
} |