I have a question about how multithreading and function calls at low-level work. If I call the rand() function from multiple threads, do they access the same function? Where is it stored in the memory? Do all threads access the same memory location for the function? If they all access the same memory location, could it be that two threads are accessing the same function at the same time so one would deadlock or bottleneck/slow down the overall process?
I want to make my threads completely parallel, so I want them to call their own instance of the rand() function. How could I go about doing that?