If you create a new layer, the parameters will be initialized, which will most likely call into a random initialization method and thus the pseudo-random number generator.
If you reset the seed after the initialization of tmp, you might get the same values.
Note that some methods are not deterministic as explained here 1.