Skip to content
This repository was archived by the owner on Mar 20, 2026. It is now read-only.
This repository was archived by the owner on Mar 20, 2026. It is now read-only.

mrand() #3

Description

@bunyk

So, since I'm noob in C++, I decided to try to build just a piece of this, something simple like Fractal.cpp:

$ g++ src/Main\ executable/Fractal.cpp -o fractal && ./fractal && eog fractal.ppm 
/usr/bin/ld: /tmp/ccQOgr8t.o: in function `GetRand(int)':
Fractal.cpp:(.text+0x10): undefined reference to `mrand()'
collect2: error: ld returned 1 exit status

I could not find implementation of this mrand() nowhere, just definitions. Google asks if I ment rand(), so when I define it like

int mrand() 
{
	return rand();
}

I'm able to get some blocky resemblance of a fractal noise using GetFractalVal():

Image

Now I wonder if my mrand() implementation matches one that is linked somehow in Visual Studio? If we change all mrand() calls to rand() would it still build for Windows? And could we add unittests to make sure behaviour does not change when porting? (Like, given this random seed, assert that this fractal is generated).

And why mrand() definitions do not come from some header file related to some DLL, but declared in every file that uses it? (That's really strange for me as a programmer that mostly uses languages where things that imported imported from where they are implemented).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions