~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to ToyKeeper/tk-random.h

  • Committer: Selene ToyKeeper
  • Date: 2023-11-04 15:09:10 UTC
  • mfrom: (483.1.175 anduril2)
  • Revision ID: bzr@toykeeper.net-20231104150910-ddd3afw4nhfvof2l
merged anduril2 branch -> fsm, with *years* of changes
(this also means this code is now Anduril 2 instead of Anduril 1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef TK_RANDOM_H
2
 
#define TK_RANDOM_H
3
 
/*
4
 
 * Smaller, pseudo-random function(s).
5
 
 *
6
 
 * Copyright (C) 2015 Selene Scriven
7
 
 *
8
 
 * This program is free software: you can redistribute it and/or modify
9
 
 * it under the terms of the GNU General Public License as published by
10
 
 * the Free Software Foundation, either version 3 of the License, or
11
 
 * (at your option) any later version.
12
 
 *
13
 
 * This program is distributed in the hope that it will be useful,
14
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
 * GNU General Public License for more details.
17
 
 *
18
 
 * You should have received a copy of the GNU General Public License
19
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 
 *
21
 
 */
 
1
// tk-random.h: Smaller pseudo-random function(s).
 
2
// Copyright (C) 2015-2023 Selene ToyKeeper
 
3
// SPDX-License-Identifier: GPL-3.0-or-later
 
4
#pragma once
22
5
 
23
6
uint8_t pgm_rand() {
24
7
    static uint16_t offset = 255;
29
12
    return pgm_read_byte(offset);
30
13
}
31
14
 
32
 
#endif  // TK_RANDOM_H