How to have random number every node run
Im using this rand() function on my code. When I first run the node, it gives me random number, but when I run the node again, it gives me the previous random number. I applied this code on turtlesim/Spawn client.
here's the snippet of the code:
srv.request.x = rand() % 12;
srv.request.y = rand() % 12;
srv.request.theta = rand() % 360;
What happen is when I run the node, it spawns a turtle at random place but when I try to run it again, it spawns to the previous place. I also tried to use for loop to spawn 5 turtles in one run. The 5 turtles spawned at different places but when I tried to run it again, another 5 turtles are spawned onto the same place.
Is there any chance that I can have different values every time I run the node?