mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2026-11-04 17:02:20 +00:00
fix significant oversights in noise & random
This commit is contained in:
1 parent
2a4eb2283a
commit
301aa28c4d
9 files changed
+41
-55
No files matched your search
@@ -1,9 +1,10 @@
|
||||
public extension MutableCollection {
|
||||
mutating func shuffle<T: RandomProvider>(using provider: inout T) {
|
||||
guard self.count > 1 else {
|
||||
let count = self.count
|
||||
guard count > 1 else {
|
||||
return
|
||||
}
|
||||
for (first, remaining) in zip(self.indices, stride(from: 0x100, to: 1, by: -1)) {
|
||||
for (first, remaining) in zip(self.indices, stride(from: count, to: 1, by: -1)) {
|
||||
let i = self.index(first, offsetBy: provider.next(in: remaining))
|
||||
self.swapAt(first, i)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user