20 views

Skip to first unread message

Jul 8, 2021, 5:00:07 PM7/8/21

to

My containernumber-generator:

10 RANDOMIZE

20 LET e$="UJZ"

30 DIM h(26)

40 FOR i=1 TO 26

50 READ h(i)

60 NEXT i

70 FOR i=1 TO 10

80 LET n$=""

90 FOR j=1 TO 3

100 LET n$=n$+CHR$ (65+INT (26*RND))

110 NEXT j

120 LET r=INT (20*RND)

130 IF r>18 THEN GO TO 160

140 LET r=1

150 GO TO 170

160 LET r=r-17

170 LET n$=n$+e$(r)

180 LET n$=n$+" "

190 FOR j=1 TO 6

200 LET n$=n$+CHR$ (48+INT (10*RND))

210 NEXT j

220 LET n$=n$+"-"

230 GO SUB 270

240 PRINT n$

250 NEXT i

260 STOP

270 REM === Checkdigit ==========

280 LET digit=0

290 LET factor=1

300 LET l=LEN (n$)

310 FOR j=1 TO l

320 LET c= CODE (n$(j))

330 LET isalpha=0: LET isdigit=0

340 IF c>=65 AND c<=90 THEN LET isalpha=1

350 IF c>=48 AND c<=57 THEN LET isdigit=1

360 IF isalpha=0 AND isdigit=0 THEN GO TO 420

370 IF isalpha=0 THEN GO TO 400

380 LET digit=digit+factor*h(c-64)

390 GO TO 410

400 LET digit=digit+factor*(c-48)

410 LET factor=2*factor

420 NEXT j

430 LET digit=digit-11*INT (digit/11)

440 LET digit=digit-10*INT (digit/10)

450 LET n$=n$+CHR$ (digit+48)

460 RETURN

470 REM === Data checksum =======

480 DATA 10,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,30,31,32,34,35,36,37,38

--

Jan v/d Broek

balg...@dds.nl

10 RANDOMIZE

20 LET e$="UJZ"

30 DIM h(26)

40 FOR i=1 TO 26

50 READ h(i)

60 NEXT i

70 FOR i=1 TO 10

80 LET n$=""

90 FOR j=1 TO 3

100 LET n$=n$+CHR$ (65+INT (26*RND))

110 NEXT j

120 LET r=INT (20*RND)

130 IF r>18 THEN GO TO 160

140 LET r=1

150 GO TO 170

160 LET r=r-17

170 LET n$=n$+e$(r)

180 LET n$=n$+" "

190 FOR j=1 TO 6

200 LET n$=n$+CHR$ (48+INT (10*RND))

210 NEXT j

220 LET n$=n$+"-"

230 GO SUB 270

240 PRINT n$

250 NEXT i

260 STOP

270 REM === Checkdigit ==========

280 LET digit=0

290 LET factor=1

300 LET l=LEN (n$)

310 FOR j=1 TO l

320 LET c= CODE (n$(j))

330 LET isalpha=0: LET isdigit=0

340 IF c>=65 AND c<=90 THEN LET isalpha=1

350 IF c>=48 AND c<=57 THEN LET isdigit=1

360 IF isalpha=0 AND isdigit=0 THEN GO TO 420

370 IF isalpha=0 THEN GO TO 400

380 LET digit=digit+factor*h(c-64)

390 GO TO 410

400 LET digit=digit+factor*(c-48)

410 LET factor=2*factor

420 NEXT j

430 LET digit=digit-11*INT (digit/11)

440 LET digit=digit-10*INT (digit/10)

450 LET n$=n$+CHR$ (digit+48)

460 RETURN

470 REM === Data checksum =======

480 DATA 10,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,30,31,32,34,35,36,37,38

--

Jan v/d Broek

balg...@dds.nl

Jul 11, 2021, 6:13:26 AM7/11/21

to

I will at least have to paste this into BASin and see what it does, now...

Jul 12, 2021, 7:05:02 AM7/12/21

to

TMD2003 <h49...@gmail.com> writes:

>I will at least have to paste this into BASin and see what it does, now...

Roughly the same as this:
>I will at least have to paste this into BASin and see what it does, now...

http://balglaas.sdf.org/random/containerno.html

It's generating containersnumbers. A couple of years ago I needed it

to create testdata. While messing with z88dk I rewrote it to C, and out

of boredom I also made a BASIC-version.

--

Jan van den Broek balg...@xs4all.nl

===============================================================================

"Het ene gaat altyd in de richting van het andere",

Johan Cruyff 3-VIII-'92

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu