Using Mql4 outside of trading . . Wow

 

I've always wanted to have the ability to code a blackjack simulator but back then coding seemed too complex an endeavor to attempt. I settled on using blackjack simulators which worked for basic stuff but the more advanced I became, the more questions I had which my commercial software couldn't answer. I taught if only I could program, then I could get some stats on how my game would be affected by changing this or that. Well I managed to answer a question in blackjack with the help of mql4 how cool is that :)

It just makes me wonder if someone else have tried using mql4 to solve a problem/question outside of trading? Well while I'm at it, I have a question about my Random_Shuffle Generator, I'm wondering if there's a Bias or Better method of programming a shuffler? Other languages like Python have built-in functions for such things. I'm wondering if it's a similar algorithm.

Here's what I'm currently using.

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void start(){
    int Decks_Shuffled[]; Shuffle_And_DeckCount(6, Decks_Shuffled);
    /*Above attempts to shuffle 6-decks of cards for a new game/shoe*/
    /*Array of shuffled cards is returned to Deck_Shuffled*/
    /*Cards are then called in a for/while ++ loop with the game function*/
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void Shuffle_And_DeckCount(int NumOfDecks, int&Decks_Shuffled[]){
    int Standard_13=13; int Std_2Deck=4;
    int Deck_RaySize=(Standard_13*Std_2Deck*NumOfDecks);
    ArrayResize(Decks_Shuffled,Deck_RaySize);
    ArrayInitialize(Decks_Shuffled,0);
    int Cnt=Deck_RaySize-1; while(Cnt>=0){
        int Randomiz_13[]; Random_QuarterDeck(Randomiz_13);
        for(int i=Standard_13-1; i>=0; i--){
            int Pos=MathRand()%Deck_RaySize;
            while(Decks_Shuffled[Pos]!=0){ Pos++;
                if(Pos>Deck_RaySize-1){Pos=0;} continue;}
            Decks_Shuffled[Pos]=Randomiz_13[i]; Cnt--;
}   }   }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void Random_QuarterDeck(int&Randomiz_13[]){
    int Standard_13[]={2,3,4,5,6,7,8,9,10,'J','Q','K','A'};
    int Standard_Sz=ArraySize(Standard_13);
    ArrayResize(Randomiz_13,Standard_Sz);
    ArrayInitialize(Randomiz_13,0); static int Seed;
    if(Seed==0){Seed=GetTickCount();}else{Seed++;} MathSrand(Seed);
    for(int i=Standard_Sz-1; i>=0; i--){
        int Pos=MathRand()%13;
        while(Randomiz_13[Pos]>0){Pos=MathRand()%13; continue;}
        Randomiz_13[Pos]=Standard_13[i];
}   }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reason: