@user1742385, rand_r modifies the parameter and you are passing it a temporary variable that will go out of scope as soon as the rand_r function is entered. You should create a variable for your seed and use that as the argument
↧