add item spawner
This commit is contained in:
17
rng.cpp
Normal file
17
rng.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// Created by Grant Horner on 12/1/25.
|
||||
//
|
||||
|
||||
#include "rng.h"
|
||||
|
||||
float Rng::generate() {
|
||||
return static_cast<float>(rng()) / static_cast<float>(std::mt19937::max());
|
||||
}
|
||||
|
||||
float Rng::generate(const uint32_t max) {
|
||||
return generate() * static_cast<float>(max);
|
||||
}
|
||||
|
||||
float Rng::generate(const int min, const int max) {
|
||||
return generate() * (static_cast<float>(max) - static_cast<float>(min)) + static_cast<float>(min);
|
||||
}
|
||||
Reference in New Issue
Block a user