home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Troubleshooting Netware Systems
/
CSTRIAL0196.BIN
/
attach
/
pcc
/
v08n03
/
netwrk.exe
/
LANBENCH.ZIP
/
NORM.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-05-05
|
3KB
|
64 lines
10 REM NORM.BAS generates normally distributed LAN noise.
20 REM ---------------------------------------------------------------
30 GOSUB 500' initialization subroutine
40 REM ---------------------------------------------------------------
50 REM main program
60 REM DEL time until next net event
70 REM NXT time of next event
80 REM TN transaction number
90 REM ---------------------------------------------------------------
100 GOSUB 310' get random variable in Z
110 DEL = M + SD*Z
120 NXT = TIMER+DEL
130 TN = TN+1
140 PRINT "Transaction"; TN; "in"; DEL; " seconds."
150 IF TIMER < NXT THEN 150
160 GOSUB 200' fire off some network activity
170 GOTO 100
180 REM -------------------------------------------------------------
190 REM Subroutine with side effect of network activity.
200 OPEN "r", 1, FLNM$, N
210 FIELD #1, N AS Q$
220 LSET Q$ = QQ$
230 PUT #1, 1
240 GET #1, 1
250 CLOSE #1
260 RETURN
270 REM -------------------------------------------------------------
280 REM This subroutine returns a standard normal random variable
290 REM in Z, but it has lots of side effects (TOGGLE, Z2, S, R1, R2).
300 REM See Byte Magazine, ???, for a discussion of the algorithm.
310 IF TOGGLE = 1 THEN Z=Z2: TOGGLE=0 : RETURN
320 TOGGLE=1: S=1
330 WHILE (S>=1)
340 R1=2*RND-1
350 R2=2*RND-1
360 S=R1^2 + R2^2
370 WEND
380 S=SQR(-2*LOG(S)/S)
390 Z=S*R1: Z2=S*R2
400 RETURN
410 REM -------------------------------------------------------------
420 REM Initialization of:
430 REM M mean time between network events
440 REM SD standard deviation of time between events
450 REM N length of pad record
460 REM D$ server "drive" for scratch file
470 REM FLNM$ name of scratch file on the server
480 REM QQ$ pad string to be written over the network
490 REM -------------------------------------------------------------
500 KEY (1) ON
510 ON KEY (1) GOSUB 630' stop execution
520 REM initialize the distribution
530 RANDOMIZE TIMER
540 INPUT "enter mean time between network activity: ", M
550 INPUT "enter the standard deviation: ",SD
560 REM initialize the file to be read
570 INPUT "enter record length: ", N
580 INPUT "enter drive identifier, without the colon: ", D$
590 FLNM$ = D$ + ":junk"
600 QQ$=STRING$ (N, "q")
610 PRINT: PRINT "Hit F1 to stop."
620 RETURN
630 END' operator hits F1 to stop execution