Lemonergy · Studio block
Uniform random source
Produces reproducible uniform samples from a nonzero 32-bit seed and holds each sample until the next instant.
- Implementation ID
native-uniform-random- Reviewed
- 2026-10-27
Behavior
x ^= x << 13; x ^= x >> 17; x ^= x << 5, using a 32-bit word. r = (x + 1)/(2³² + 1); y = lower + r(upper − lower).
Interface
| Name | Direction | Unit | Meaning |
|---|---|---|---|
out0 | output | 1 | Signal; real scalar. |
Parameters
Defaults are initial model values. Select values for your own model and operating conditions.
| Parameter | Unit | Default | Meaning and limits |
|---|---|---|---|
Sample periodsampleTimeS | s | 0.1 | Positive interval between sample instants. Values are held between samples. Minimum 0 |
Seed (1–4294967295)params[0] | 1 | 1 | Configured value for Seed (1–4294967295). |
Minimumparams[1] | 1 | 0 | Configured value for Minimum. |
Maximumparams[2] | 1 | 1 | Configured value for Maximum. |
Equations and rules
x ^= x << 13; x ^= x >> 17; x ^= x << 5, using a 32-bit wordr = (x + 1)/(2³² + 1); y = lower + r(upper − lower)
Worked example
Uniform random source — worked example
Use the configured source parameters. Signal at 0 s = 0.00006295042111003994.
Open Studio example after release →| Output | Time (s) | Expected value | Unit | Absolute tolerance |
|---|---|---|---|---|
Signalout0 | 0 | 6.295042111003994e-05 | 1 | 1e-12 |
Explore the recorded outputs
Uniform random source recorded example
Uniform random source11 actual recorded samples. Lines are visual guides between samples. Synthetic example, not measured cell data.
Read the selected signal as a table
| Time (s) | Value |
|---|
Download the recorded samples (JSON) · Open this Studio example after release
Use in a workflow
Uniform random source — worked example
Produces reproducible uniform samples from a nonzero 32-bit seed and holds each sample until the next instant.
- Uniform random source: x ^= x << 13; x ^= x >> 17; x ^= x << 5, using a 32-bit word. r = (x + 1)/(2³² + 1); y = lower + r(upper − lower).
- Use the block reference for settings and connections.
- Implementation tested locally; public release pending.
Connected concepts
Limits and interpretation
- Deterministic simulation noise, not a cryptographic generator. Samples lie strictly between configured bounds; seed zero is invalid.
Scientific and mathematical references
These sources explain the scientific and mathematical background. The behavior, interface and limits above define the Lemonergy implementation; a citation does not imply every model option in the source is implemented.
- Xorshift RNGs
George Marsaglia · Journal of Statistical Software, 8(14) · 2003
Technical reference · Xorshift random number generation; the exact 32-bit shifts and uniform scaling used here are specified by the Lemonergy contract.
Implementation sources
This reference follows the public interface and locally verified numerical checks for an upcoming release.
Contract: Lemonergy Studio public contract · Verification record: verification-2026-10-27
docs/glossary/native-block-verification.json
This implementation and its workflow uses (JSON) · Knowledge graph (JSON-LD)