Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified BINARIES/LinuxChatScript64
Binary file not shown.
8 changes: 7 additions & 1 deletion SRC/mainSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ bool server = true; // default is server on LINUX
#endif
#endif
unsigned int port = 1024; // server port
int random_seed = -1; // random seed -1 means random seed is not set
bool commandLineCompile = false;

PrepareMode tmpPrepareMode = NO_MODE; // controls what processing is done in preparation NO_MODE, POS_MODE, PREPARE_MODE
Expand Down Expand Up @@ -659,6 +660,7 @@ static void ProcessArgument(char* arg)
size_t len = strlen(hide);
if (hide[len - 1] == '"') hide[len - 1] = 0;
}
else if (!strnicmp(arg, (char*)"seed=", 5)) random_seed = atoi(arg+5);
#ifndef DISCARDSERVER
else if (!stricmp(arg,(char*)"serverretry")) serverRetryOK = true;
else if (!stricmp(arg,(char*)"local")) server = false; // local standalone
Expand Down Expand Up @@ -793,6 +795,10 @@ unsigned int InitSystem(int argcx, char * argvx[],char* unchangedPath, char* rea

int oldserverlog = serverLog;
serverLog = true;
if (random_seed != -1) {
printf((char*)"Set random number %d\r\n", random_seed);
srand(random_seed);
}

#ifndef DISCARDSERVER
if (server)
Expand Down Expand Up @@ -1151,7 +1157,7 @@ void ProcessInputFile()
//output user prompt
if (documentMode || silent) {;} // no prompt in document mode
else if (*userPrefix) printf((char*)"%s ", ReviseOutput(userPrefix));
else printf((char*)"%s",(char*)" >");
else printf((char*)"[%d]> ", volleyCount);

*ourMainInputBuffer = ' '; // leave space at start to confirm NOT a null init message, even if user does only a cr
ourMainInputBuffer[1] = 0;
Expand Down
15 changes: 10 additions & 5 deletions SRC/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1481,11 +1481,16 @@ uint64 Hashit(unsigned char * data, int len,bool & hasUpperCharacters, bool & ha
return crc;
}

unsigned int random(unsigned int range)
{
if (regression || range <= 1) return 0;
unsigned int x = (unsigned int)X64_Table[randIndex++ % MAXRAND];
return x % range;
//unsigned int random(unsigned int range)
//{
// if (regression || range <= 1) return 0;
// unsigned int x = (unsigned int)X64_Table[randIndex++ % MAXRAND];
// printf((char*)"\r\nRandom number %d\r\n",x);
// return x % range;
//}

unsigned int random(unsigned int range) {
return rand() % range;
}

/////////////////////////////////////////////////////////
Expand Down