Is there an alternative to using time to seed a random number generation?

前端 未结 10 647
既然无缘
既然无缘 2020-11-27 06:30

I\'m trying to run several instances of a piece of code (2000 instances or so) concurrently in a computing cluster. The way it works is that I submit the jobs and the clust

10条回答
  •  猫巷女王i
    2020-11-27 07:06

    If uniqueness is important, you need to arrange for each node to know what IDs have been claimed by others. You could do this with a protocol asking "anyone claimed ID x?" or arranging in advance for each node to have a selection of IDs which have not been allocated to others.

    (GUIDs use the machine's MAC, so would fall into the "arrange in advance" category.)

    Without some form of agreement, you'll risk two nodes climing the same ID.

提交回复
热议问题