# 10liner basic parallax scrolling

Página 3/3
1 | 2 |

Maybe a bit off-topic, but just in case you want to know how the RND works on MSX, it is calculated from previous value like this:

NEW = FRC(21132486540519 * OLD + 0.14389820420821)

Because it is quite a hard to understand it like this, here is a BASIC program that simulates RND function :

```10 ' We have to split these numbers, other ways BASIC is
20 ' going to lose some important decimals :
30 '
40 M1= 21132480000000#:  A1= .1438982#
50        M2= 6540519#:            A2=4.20821E-09
60 '
70 R=RND(-TIME) ' Here we give a new seed for RND function. Seed is always
80 '              reset when we start running a BASIC program.
90 '
100 CLS
110 PRINT "If you are going to use positive numbers for RND(X) function,"
120 PRINT "here is next 10 values, that you are going to get :"
130 PRINT STRING\$(65,"-")
140 '
150 FOR I = 0 TO 9
160 '
170 L1 = 1E-07*INT(R*10000000!)
180 L2 = R-L1
190 HE = 10000000!*(M2*L2+A2)
200 H1 = (M1*L2)-INT(M1*L2)
210 H2 = (M2*L1)-INT(M2*L1)
220 H3 = H1 + H2 + A1 + 1E-07 * INT(HE)
230 H4 = H3 - INT(H3)
240 H5 = 1E-07*(HE - INT(HE))
250 R  = H4 + H5
260 PRINT I;"|";R
270 '
280 NEXT I
```

I think that almost nothing is OT when you talk about coding. It was indeed very interesting

Página 3/3
1 | 2 |