Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flow3r
flow3r firmware
Merge requests
!72
bl00mbox: plugin stuff
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
bl00mbox: plugin stuff
moon2_applications
into
main
Overview
0
Commits
1
Pipelines
1
Changes
16
Merged
moon2
requested to merge
moon2_applications
into
main
1 year ago
Overview
0
Commits
1
Pipelines
1
Changes
16
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
90bf0a46
1 commit,
1 year ago
16 files
+
628
−
130
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
16
Search (e.g. *.vue) (Ctrl+P)
components/bl00mbox/extern/xoroshiro64star.c
0 → 100644
+
45
−
0
Options
/* Written in 2016 by David Blackman and Sebastiano Vigna (vigna@acm.org)
To the extent possible under law, the author has dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
See <http://creativecommons.org/publicdomain/zero/1.0/>. */
#include
<stdint.h>
/* This is xoroshiro64* 1.0, our best and fastest 32-bit small-state
generator for 32-bit floating-point numbers. We suggest to use its
upper bits for floating-point generation, as it is slightly faster than
xoroshiro64**. It passes all tests we are aware of except for linearity
tests, as the lowest six bits have low linear complexity, so if low
linear complexity is not considered an issue (as it is usually the
case) it can be used to generate 32-bit outputs, too.
We suggest to use a sign test to extract a random Boolean value, and
right shifts to extract subsets of bits.
The state must be seeded so that it is not everywhere zero. */
static
inline
uint32_t
rotl
(
const
uint32_t
x
,
int
k
)
{
return
(
x
<<
k
)
|
(
x
>>
(
32
-
k
));
}
// mod1: state seed
static
uint32_t
s
[
2
]
=
{
420
,
69
};
//uint32_t next(void) {
uint32_t
xoroshiro64star
(
void
)
{
// mod2: changed name to avoid namespace collisions.
const
uint32_t
s0
=
s
[
0
];
uint32_t
s1
=
s
[
1
];
const
uint32_t
result
=
s0
*
0x9E3779BB
;
s1
^=
s0
;
s
[
0
]
=
rotl
(
s0
,
26
)
^
s1
^
(
s1
<<
9
);
// a, b
s
[
1
]
=
rotl
(
s1
,
13
);
// c
return
result
;
}
Loading