Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Interpretml Interpret RandomDeterministic

From Leeroopedia


Knowledge Sources
Domains Machine_Learning, EBM_Core
Last Updated 2026-02-07 12:00 GMT

Overview

Implements the seed conversion logic for the deterministic random number generator using a one-time pad XOR scheme.

Description

The RandomDeterministic.cpp file provides the implementation of GetOneTimePadConversion, which converts user-provided seeds into the internal state format used by the Middle Square Weyl Sequence RNG. It uses a table of 64 pre-generated random uint64_t values as a one-time pad. For each bit set in the input seed, the corresponding pad value is XORed into the result, starting from a base value of 0x6b79a38fd52c4e71 (which ensures a valid state even for seed=0). This approach ensures that similar seed values produce very different internal states, providing good seed independence. The function also includes the Initialize method which sets the three internal state variables (m_state1, m_state2, m_stateSeedConst) from the converted seed.

Usage

Called once when a RandomDeterministic object is initialized with a user seed. The converted seed is then used as the constant addend in the Middle Square Weyl Sequence, ensuring deterministic but well-distributed random number generation throughout the boosting process.

Code Reference

Source Location

Signature

static const uint_fast64_t k_oneTimePadSeed[64]{ ... };

uint_fast64_t RandomDeterministic::GetOneTimePadConversion(uint_fast64_t seed);

void RandomDeterministic::Initialize(const uint64_t seed);

I/O Contract

Input Description
seed 64-bit user-provided seed value
Output Description
uint_fast64_t return Converted seed via one-time pad XOR
(Initialize) Sets m_state1, m_state2, m_stateSeedConst internal state

Usage Examples

# Called internally via native bindings
from interpret.glassbox import ExplainableBoostingClassifier
ebm = ExplainableBoostingClassifier(random_state=42)
ebm.fit(X, y)  # Seed 42 is converted via one-time pad for internal RNG

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment