vbscript - Different random numbers at same time -
i have vbscript looks this
randomize dim oapi, obag set oapi = createobject("mom.scriptapi") set obag = oapi.createpropertybag() call obag.addvalue("random performance", int(rnd*100)+1) call oapi.return(obag)
now, multiple instances of script run @ same exact time, they're being seeded @ same time. result, give same random number @ time. there possibly way make them give different random values @ same time?
i had success this, although don't know how you're running scripts reproduced problem using start /b
' create number guid dim g g = mid(createobject("scriptlet.typelib").guid, 2, 36) dim i, c, s s = 0 = 1 len(g) c = mid(g, i, 1) if not isnumeric(c) c = asc(c) end if s = cint(c) + s next randomize s = 0 5 wscript.echo(wscript.arguments(0) & " " & g & " " & cint(rnd*100)) next
running
start /b cscript test.vbs //nologo 1 start /b cscript test.vbs //nologo 2 start /b cscript test.vbs //nologo 3 start /b cscript test.vbs //nologo 4 start /b cscript test.vbs //nologo 5
sample output
2d1f39b7-6158-4c77-893b-5c749cf5537f 32 1
2d1f39b7-6158-4c77-893b-5c749cf5537f 13 1
2d1f39b7-6158-4c77-893b-5c749cf5537f 49 1
2d1f39b7-6158-4c77-893b-5c749cf5537f 51 1
2d1f39b7-6158-4c77-893b-5c749cf5537f 84 1
2d1f39b7-6158-4c77-893b-5c749cf5537f 59 3
dc29edbd-9c63-495b-afb6-a4a18f65c7f8 35 3
dc29edbd-9c63-495b-afb6-a4a18f65c7f8 86 3
dc29edbd-9c63-495b-afb6-a4a18f65c7f8 80 3
dc29edbd-9c63-495b-afb6-a4a18f65c7f8 3 3
dc29edbd-9c63-495b-afb6-a4a18f65c7f8 90 3
dc29edbd-9c63-495b-afb6-a4a18f65c7f8 49 4
dc7d2269-436f-4053-b008-f9375ba50f30 34 4
dc7d2269-436f-4053-b008-f9375ba50f30 88 4
dc7d2269-436f-4053-b008-f9375ba50f30 85 4
dc7d2269-436f-4053-b008-f9375ba50f30 60 4
dc7d2269-436f-4053-b008-f9375ba50f30 5 4
dc7d2269-436f-4053-b008-f9375ba50f30 52 2
22f2d6a9-cbf4-48d5-919b-05798fc1bfb1 7 2
22f2d6a9-cbf4-48d5-919b-05798fc1bfb1 89 2
22f2d6a9-cbf4-48d5-919b-05798fc1bfb1 14 2
22f2d6a9-cbf4-48d5-919b-05798fc1bfb1 68 2
22f2d6a9-cbf4-48d5-919b-05798fc1bfb1 89 2
22f2d6a9-cbf4-48d5-919b-05798fc1bfb1 73 5
b13e0d1a-1f93-4387-8cfe-70eef7fb9b4f 60 5
b13e0d1a-1f93-4387-8cfe-70eef7fb9b4f 71 5
b13e0d1a-1f93-4387-8cfe-70eef7fb9b4f 48 5
b13e0d1a-1f93-4387-8cfe-70eef7fb9b4f 31 5
b13e0d1a-1f93-4387-8cfe-70eef7fb9b4f 3 5
b13e0d1a-1f93-4387-8cfe-70eef7fb9b4f 19 5
Comments
Post a Comment