mirror of
https://github.com/pim-n/road-gen.git
synced 2026-02-03 09:23:09 +01:00
Replace generic np.random statements with object-specific rng
This commit is contained in:
@ -55,10 +55,10 @@ class RandomRoadGenerator(BaseRoadGenerator):
|
|||||||
# Randomly add multiple straight sections
|
# Randomly add multiple straight sections
|
||||||
i = 0
|
i = 0
|
||||||
while i < num_points:
|
while i < num_points:
|
||||||
if np.random.rand() < straight_section_prob:
|
if self._rng.random() < straight_section_prob:
|
||||||
# Random straight segment length
|
# Random straight segment length
|
||||||
max_len = int(num_points * straight_section_max_rel_size)
|
max_len = int(num_points * straight_section_max_rel_size)
|
||||||
seg_len = np.random.randint(1, max_len + 1)
|
seg_len = self._rng.integers(1, max_len + 1)
|
||||||
curvature[i:i+seg_len] = 0 # set curvature to zero for straight
|
curvature[i:i+seg_len] = 0 # set curvature to zero for straight
|
||||||
i += seg_len # skip over straight segment
|
i += seg_len # skip over straight segment
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user