⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 randintv.m

📁 ITU-T G.723.1 Speech Coder: Matlab implementation This package implements the speech coder and de
💻 M
字号:
function [iR, Seed] = RandIntV (Seed, N)% Generate a random integer in the interval [0, N-1].% The original C-code for random number generation was as follows:%   *p = (Word16)(((*p)*521L + 259) & 0x0000ffff)% This code uses integer arithmetic: The seed (Word16) is promoted% to long before being multiplied by 521. The result is masked to% 16 bits.%% Here we work with unsigned integer values (in Matlab doubles).   % $Id: RandIntV.m 1.5 2004/08/25 G.723.1-v2r1a $if (N == 1)  iR = 0;    % Don't invoke the random number generatorelse  Seed = mod (521 * Seed + 259, 65536);  iR = fix (mod (Seed, 32768) * N / 32768);endreturn

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -