ACS: random() alternatives?
Posted: Sun Feb 17, 2013 11:14 pm
I think we all know that the RNG is complete shit. What are the accepted tricks to try and get more randomness from a random(x,y) ACS call?
Leading the way in newschool multiplayer Doom online
https://zandronum.com/forum/
Are you referring to this issue?Balrog wrote: I think we all know that the RNG is complete shit.
Currently two calls in an OPEN script a random(1,14) call and a random(1000,1031) call 5 seconds later. (I've been meaning to make it a 64-player deal, but I've also got a clunky old inventory-based death manager that I don't want to strain any further) The second call gets repeated until it comes up with the TID of a extant player. The solution I'm thinking of based on Ijon's response is running random(1,500) random(1,dmflags%10+1) times, but I'm open to suggestions.Qent wrote: What are you using it for?
Maybe....Torr Samaho wrote:Are you referring to this issue?Balrog wrote: I think we all know that the RNG is complete shit.
Code: Select all
function int newRandom(int x, int y)
return random(timer() + x, timer() + y) - timer();Code: Select all
function int timerRandom(int x, int y)
return random(timer() + x, timer() + y) - timer();
script 999 UNLOADING
ConsoleCommand(StrParam(s:"set sv_oldseed ", d:timerRandom(timer(), GetCvar("sv_oldseed"))));
function int newRandom(int x, int y)
return random(GetCvar("sv_oldseed") + x, GetCvar("sv_oldseed") + y) - GetCvar("sv_oldseed");
script 1 (void) // your script
{
// Blah
myRandom = newRandom(0, 31);
}You can easily tell whether this is your problem or not as the issue described in the ticket only affects how the RNG is initialized after a map change.Balrog wrote:Maybe....Torr Samaho wrote: Are you referring to this issue?
Code: Select all
Script 1 (void)
{
boss = random(1,12);
If(PlayerCount() >= 3){
boss = random(1,14);
}
terminate;
}
Script 2 OPEN
{
if(Timer()>0){
terminate;
}
ACS_Execute(1,0);
Delay(35*5);
ACS_Execute(3,0);
}
Script 3 (void)
{
BossPlayer= random(1000,1031);
if(LastBossPlayer == BossPlayer){
Delay(2);
restart;
}
if(LastBoss == boss){
ACS_Execute(1,0);
Delay(1);
restart;
}
/* Stuff here makes decisions on what to do and who to do it to based on the values of boss and BossPlayer, sets the values of LastBoss and LastBossPlayer to equal boss and BossPlayer, and then terminates if a sanity check shows that it was successful */
restart;
}