40 lines
1.4 KiB
Arduino
40 lines
1.4 KiB
Arduino
|
// Generate_Random_Numbers - This sketch makes use of the Entropy library
|
||
|
// to produce a sequence of random integers and floating point values.
|
||
|
// to demonstrate the use of the entropy library
|
||
|
//
|
||
|
// Copyright 2012 by Walter Anderson
|
||
|
//
|
||
|
// This file is part of Entropy, an Arduino library.
|
||
|
// Entropy is free software: you can redistribute it and/or modify
|
||
|
// it under the terms of the GNU General Public License as published by
|
||
|
// the Free Software Foundation, either version 3 of the License, or
|
||
|
// (at your option) any later version.
|
||
|
//
|
||
|
// Entropy is distributed in the hope that it will be useful,
|
||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
// GNU General Public License for more details.
|
||
|
//
|
||
|
// You should have received a copy of the GNU General Public License
|
||
|
// along with Entropy. If not, see <http://www.gnu.org/licenses/>.
|
||
|
//
|
||
|
// Edited by Starbeamrainbowlabs 2019
|
||
|
|
||
|
#include "Entropy.h"
|
||
|
|
||
|
void setup() {
|
||
|
Serial.begin(9600);
|
||
|
|
||
|
// This routine sets up the watch dog timer with interrupt handler to maintain a
|
||
|
// pool of real entropy for use in sketches. This mechanism is relatively slow
|
||
|
// since it will only produce a little less than two 32-bit random values per
|
||
|
// second.
|
||
|
Entropy.initialize();
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
|
uint32_t random_long;
|
||
|
random_long = Entropy.random();
|
||
|
Serial.println(random_long);
|
||
|
}
|