#48378 - 1999-10-19 04:27 PM
RND not generating random code
|
Anonymous
Anonymous
Unregistered
|
KIX 3.61. Having a problem getting random numbers out of RND. Want to use the results to pull files out of a directory to update McAfee files from but am getting the same number generated each time. Here is the code (note the tag file vscan95.tag which controls running this or not): If EXIST ("C:\Program Files\Network Associates\McAfee VirusScan\vscan95.tag") ELSE SRND(5) $McAfee = RND(5) Copy "\\NTAPP1\APPS\BackWeb\Vscan\Win95\" + $McAfee + "\*.*" "C:\Program Files\Network Associates\McAfee VirusScan\" endif
Thanks for any help,
Pete Carstensen
|
|
Top
|
|
|
|
#48379 - 1999-10-27 10:17 AM
Re: RND not generating random code
|
Anonymous
Anonymous
Unregistered
|
This one pressed my curiosity buttons!You are basically after one random number each time the script is invoked. Using the same seed each time will result in the same pseudo-random number being generated. Indeed with such a small range (0-5) it would appear in Kixtart that you need a seed number "randomly" picked from a very large range (at least around 0-10000 approximately) in order to get a different first number returned from RND(5) each time the script is invoked. You could use the 3 numbers in @TIME multiplied together to generate the seed like this: code:
$hh=val(substr(@TIME,1,2))+1 $mm=val(substr(@TIME,4,2))+1 $ss=val(substr(@TIME,7,2))+1 SRND($hh*$mm*$ss) $McAfee = RND(5) ? $McAfee
|
|
Top
|
|
|
|
#48380 - 1999-10-29 11:39 AM
Re: RND not generating random code
|
Anonymous
Anonymous
Unregistered
|
Just to nose in on the McAfee issue. Are you trying to use this to update the Dat files? Just copying the files won't work because the program holds open scan.dat and you won't be able to replace it.That's why McAfee has had to use the autoupgrade/autoupdate system or the Superdats. They stop the service, copy and start the service on NT and on 9x they set up the copy to happen before McAfee starts the next time. So with that speil, how does your script work? It seems to have the random in the path. It's not like you are copying from different servers, just different directories. Why? Or am I wrong? ------------------
|
|
Top
|
|
|
|
#48381 - 1999-10-30 12:46 AM
Re: RND not generating random code
|
Anonymous
Anonymous
Unregistered
|
Ok, just a bit more info. I am using the RND function to determine one of six subdirectories to copy the McAfee control files from. In each of these directories, there is a configured avconsole.ini, update.ini, and default.vsh file. These are preconfigured to auto-update at different days and times. The goal is to avoid having everyone in the company begin the update process all at the same time which would put a significant strain on our network infrastructure. By randomizing the schedule files, and then utilizing the randomize within the hour function of McAfee, we get the dat updates pretty well spread out. The next issue is that the DAT files are not enough given that the engine is updated almost as much as the DAT files. About the only way I can do the SDAT update is to put it in the login script but want to limit it to run once only. I am beginning to think that McAfee used Rube Goldberg to plan out their update process! Pete Carstensen
|
|
Top
|
|
|
|
#48383 - 2000-10-20 07:31 AM
Re: RND not generating random code
|
cj
MM club member
   
Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
|
Sorry to say something so late, but I found this by chance...The SRND() function does not work with variables: ie $r=10 SRND($r) is not the same as SRND(10) in that it doesn't work. If you want to SRND() a variable this is one way: code:
$seed=val(substr("@time", 7, 2)) $seed=$seed+1 do $=rnd(1) $seed=$seed-1 until $seed=0
this can be shortened to code:
$seed=val(substr("@time", 7, 2)) $seed=$seed+1 do $=rnd(1) $seed=$seed-1 until $seed=0
This is a bs way of doing this, but it is effective enough... it is basically a 1 in 60 chance of a random seed. cj
[This message has been edited by cj (edited 20 October 2000).]
|
|
Top
|
|
|
|
#48384 - 2000-10-20 04:09 PM
Re: RND not generating random code
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
Pete:What version of Mcafee are you using? I have had wonderful success using Mcafee's build in autoupgrade to keep my clients up to date. just as an example... I DL'd he latest superdat yesterday, placed it in the correct location and renamed it. As of this morning all of my clients will be running 4.0.4100 / 4.0.70 IF you want more information on what I am doing I will be glad to help. here are a few links This is what I first did for Win9x McAfee installation ideas and pointers Here is something for NT Modify Mcafee 4.x on NT to use AutoUpgrade
Bryce [This message has been edited by Bryce (edited 20 October 2000).]
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1160 anonymous users online.
|
|
|