📄 random.f,v
字号:
head 1.3;access;symbols;locks; strict;comment @* @;1.3date 96.03.20.16.13.54; author jaf; state Exp;branches;next 1.2;1.2date 96.03.14.22.25.29; author jaf; state Exp;branches;next 1.1;1.1date 96.02.07.14.49.01; author jaf; state Exp;branches;next ;desc@@1.3log@Rearranged comments a little bit, and added comments explaining thateven though there is local state here, there is no need to create anENTRY for reinitializing it.@text@************************************************************************* RANDOM Version 49** $Log: random.f,v $* Revision 1.2 1996/03/14 22:25:29 jaf* Just rearranged the comments and local variable declarations a bit.** Revision 1.1 1996/02/07 14:49:01 jaf* Initial revision************************************************************************** Pseudo random number generator based on Knuth, Vol 2, p. 27.** Function Return:* RANDOM - Integer variable, uniformly distributed over -32768 to 32767* * This subroutine maintains local state from one call to the next.* In the context of the LPC10 coder, there is no reason to reinitialize* this local state when switching between audio streams, because its* results are only used to generate noise for unvoiced frames.* FUNCTION RANDOM () INTEGER RANDOM* Parameters/constants INTEGER MIDTAP, MAXTAP PARAMETER (MIDTAP=2, MAXTAP=5)* Local state INTEGER J, K INTEGER*2 Y(MAXTAP) SAVE J, K, Y DATA J/MIDTAP/, K/MAXTAP/ DATA Y /-21161, -8478, 30892,-10216, 16950/* The following is a 16 bit 2's complement addition,* with overflow checking disabled Y(K) = Y(K) + Y(J) RANDOM = Y(K) K = K - 1 IF (K .LE. 0) K = MAXTAP J = J - 1 IF (J .LE. 0) J = MAXTAP RETURN END@1.2log@Just rearranged the comments and local variable declarations a bit.@text@d6 3d19 5d28 2d33 1a33 1* Local variablesd37 1d39 2a41 1 DATA J/MIDTAP/, K/MAXTAP/@1.1log@Initial revision@text@d5 4a8 1* $Log$d18 3a20 1 INTEGER RANDOM, J, K, MIDTAP, MAXTAPd22 4@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -