I'll take a guess because your "question" is rather vague. This appears to be an attempt at making a singly-linked list. They way you are doing is unusual and I don't understand how it could work correctly. Here is your function tweaked a bit to act more like a standard linked list.
SpinnerSlot* AddSlot( SpinnerSlot* last, string name )
{
SpinnerSlot* newSlot = (SpinnerSlot*)calloc( sizeof( struct SpinnerSlot ), 1 );
if( newSlot )
{
newSlot->name = name;
newSlot->next = nullptr; }
if( last )
{
last->next = newSlot; }
return newSlot;
}
Typically, the end of the list is the newest one added so it will have a null next pointer and the previous end of the list will now have the newest one as its next. This way should still work with your
Print
and
Spin
functions.
One other thing - typically when one uses a PRNG it is seeded only once at the start of the program. That is the call to
srand
. It should be called just once as one of the first things done in
main
.