LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
matlab_rng.h File Reference

MATLAB-faithful random draws for the model generators: the C++ twin of the JAR jline.gen.MatlabRandom and the native Python line_solver.gen.matlab_rng. More...

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <numeric>
#include <vector>
#include "line/opt/de/numpy_random_state.h"
Include dependency graph for matlab_rng.h:

Go to the source code of this file.

Classes

class  line::gen::MatlabRng
 One MATLAB global random stream, as left by rng(seed). More...

Namespaces

namespace  line
 Conservation laws of a layered queueing network, enumerated from its structure.
namespace  line::gen

Detailed Description

MATLAB-faithful random draws for the model generators: the C++ twin of the JAR jline.gen.MatlabRandom and the native Python line_solver.gen.matlab_rng.

A MatlabRng seeded with s yields the stream MATLAB yields after rng(s) (MT19937 init_genrand, numpy's legacy RandomState(s)). rand is numpy's random_sample, randi(lo, hi) is lo-1+ceil((hi-lo+1)*rand) (a degenerate range still consumes a draw), randperm(n) is the stable sort order of rand(1,n) and randfixedsum is Roger Stafford's original, draw for draw. Checked against MATLAB R2026a on 2026-10-13.

Unlike MATLAB's global generator the stream here belongs to its owner, so two generators never share one; within one generator the draw sequence is MATLAB's.

Definition in file matlab_rng.h.