Skip to content

Commit 36f4238

Browse files
committed
seed actor rng with std rng
1 parent 1499aba commit 36f4238

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

external/DifferentialEq.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ SYCL_EXTERNAL void differentialEq(
9696
sycl::float2 currentToNeighbour = pos - neighbour.getPos();
9797
float dij = magnitude(currentToNeighbour);
9898
float rij = neighbour.getRadius() + currentActor->getRadius();
99-
sycl::float2 nij = (currentToNeighbour) / dij;
99+
sycl::float2 nij = currentToNeighbour / dij;
100100
sycl::float2 tij = getTangentialVector(nij);
101101
float g = dij > rij ? 0 : rij - dij;
102102
float deltavtij = dotProduct(

scripts/InputFileGenerator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def workingAnimation():
5555
time.sleep(0.1)
5656
print("Input files have been writted to ../input")
5757

58-
5958
def main(argv):
6059
if len(argv) == 0:
6160
toGenerate = [

src/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ void init(int &WIDTH, int &HEIGHT, int &SCALE, int &DELAY,
6464
throw std::invalid_argument("Too many inputs were supplied");
6565
}
6666

67-
// Seed RNG with current time in seconds
68-
GLOBALSEED = uint(time(0));
69-
// Seed each actor's RNG using global seed
67+
std::random_device rd;
68+
// Seed each actor's RNG using std rng
7069
for (auto actor : actors) {
71-
GLOBALSEED = randXorShift(GLOBALSEED);
72-
actor.setSeed(GLOBALSEED);
70+
std::mt19937 gen(rd());
71+
std::uniform_int_distribution<> distr(-1000, 1000);
72+
actor.setSeed(distr(gen));
7373
}
7474
}
7575

0 commit comments

Comments
 (0)