Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Number Randomization


luksamuk

Recommended Posts

So yeah, a friend of mine was asking me about randomizing values in MMF2, and although he seemed to just use the random() instruction, I always felt like it didn't randomize properly... and I don't wanna use extensions either.

So, I was wondering, is there any way you can successfully implement THIS C code in MMF2?

#include <iostream>
#include <cstdlib>
#include <ctime>

const int maxValue = 4;

int main()
{
    srand(time(NULL)); //Makes the randomizer... really randomic
    return rand() % maxValue + 1; //Returns a random value between 0 and the maxValue
}

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...