Skip to content

Commit

Permalink
Fix spelling of pseudo (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzerrell committed Aug 16, 2022
1 parent a94a359 commit e0e39ed
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion risc0/core/rng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern uint32_t get_random_u32();

namespace risc0 {

PsuedoRng::PsuedoRng() {
PseudoRng::PseudoRng() {
static uint64_t seed = CryptoRng::shared().generate();
static bool logged = false;
if (!logged) {
Expand Down
6 changes: 3 additions & 3 deletions risc0/core/rng.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ namespace risc0 {
/// Uses `std::mt19937_64` under the hood.
/// Basically, only really used for tests.
/// For this reason, when default constructed, it pick and log a per-process seed.
class PsuedoRng {
class PseudoRng {
public:
/// Seed with a process specific seed, log on first construction.
PsuedoRng();
PseudoRng();

/// Construct a reproducable PRNG with a specific seed.
explicit PsuedoRng(uint64_t seed) : state_(seed) {}
explicit PseudoRng(uint64_t seed) : state_(seed) {}

/// Generate a random 32-bit value uniformly selected over all values.
uint32_t generate() { return static_cast<uint32_t>(state_()); }
Expand Down
2 changes: 1 addition & 1 deletion risc0/zkp/accel/test/ntt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void testNTT(const char* name,
std::vector<Fp> b(size * count);
LOG(1, "Testing " << name);
{
PsuedoRng rng(2);
PseudoRng rng(2);
LOG(1, "Randomizing");
AccelReadWriteLock cpuA(a);
for (size_t i = 0; i < size * count; i++) {
Expand Down
4 changes: 2 additions & 2 deletions risc0/zkp/accel/test/test_accel.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void testAccelUnary(const char* name, AccelFunc accelFunc, CpuFunc cpuFunc, size
LOG(1, "Testing " << name);
std::vector<T> goldenOut(count);
{
PsuedoRng rng(2);
PseudoRng rng(2);
LOG(1, "Randomizing");
AccelReadWriteLock cpuA(a);
for (size_t i = 0; i < count; i++) {
Expand Down Expand Up @@ -63,7 +63,7 @@ void testAccelBinary(const char* name, AccelFunc accelFunc, CpuFunc cpuFunc, siz
LOG(1, "Testing " << name);
std::vector<T> goldenOut(count);
{
PsuedoRng rng(2);
PseudoRng rng(2);
LOG(1, "Randomizing");
AccelReadWriteLock cpuA(a);
AccelReadWriteLock cpuB(b);
Expand Down
2 changes: 1 addition & 1 deletion risc0/zkp/core/bench/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static void BM_Interpolate_NTT(benchmark::State& state) {
size_t size = 1 << n;

std::vector<Fp> buf(size);
PsuedoRng rng(2);
PseudoRng rng(2);
for (size_t i = 0; i < size; i++) {
buf[i] = Fp::random(rng);
}
Expand Down
2 changes: 1 addition & 1 deletion risc0/zkp/core/test/fp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace risc0 {

// Compare core operations against simple % P implementations
TEST(Fp, FpCompareNative) {
PsuedoRng rng(2);
PseudoRng rng(2);
for (size_t i = 0; i < 100000; i++) {
Fp fa = Fp::random(rng);
Fp fb = Fp::random(rng);
Expand Down
2 changes: 1 addition & 1 deletion risc0/zkp/core/test/fp4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace risc0 {

TEST(Fp4, IsaField) {
PsuedoRng rng(2);
PseudoRng rng(2);
// Pick random sets of 3 elements of Fp4, and verify they meet the requirements of a field.
for (size_t i = 0; i < 1000000; i++) {
Fp4 a = Fp4::random(rng);
Expand Down
6 changes: 3 additions & 3 deletions risc0/zkp/core/test/ntt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ TEST(NTT, CmpEvaluate) {
size_t size = (1 << N);
std::vector<Fp> in(size);
// Randomly fill input
PsuedoRng rng(2);
PseudoRng rng(2);
for (size_t i = 0; i < size; i++) {
in[i] = Fp::random(rng);
}
Expand Down Expand Up @@ -59,7 +59,7 @@ TEST(NTT, Roundtrip) {
size_t size = (1 << N);
std::vector<Fp> buf(size);
// Randomly fill buffer
PsuedoRng rng(2);
PseudoRng rng(2);
for (size_t i = 0; i < size; i++) {
buf[i] = Fp::random(rng);
}
Expand All @@ -82,7 +82,7 @@ TEST(NTT, Expand) {
size_t sizeOut = (1 << N);
std::vector<Fp> cmp(sizeIn);
std::vector<Fp> buf(sizeOut);
PsuedoRng rng(2);
PseudoRng rng(2);
for (size_t i = 0; i < sizeIn; i++) {
cmp[i] = Fp::random(rng);
}
Expand Down
2 changes: 1 addition & 1 deletion risc0/zkp/core/test/sha256.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ TEST(Sha256, TestVectors) {

TEST(Sha256, compareFpVsBytes) {
// Try sizes 0 - 100 for variety
PsuedoRng rng(2);
PseudoRng rng(2);
for (size_t i = 0; i < 100; i++) {
// Make a vector of fp values and their 'stringified' form
std::vector<Fp> vals(i);
Expand Down
2 changes: 1 addition & 1 deletion risc0/zkp/prove/test/fri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TEST(Prove, FRI) {
size_t deg = 8192;
size_t domain = deg * kInvRate;
// Make a random polynomial
PsuedoRng rng(3);
PseudoRng rng(3);
LOG(1, "Making random poly, in 'colwise' Fp4");
auto poly = AccelSlice<Fp>::allocate(deg * 4);
{
Expand Down
4 changes: 2 additions & 2 deletions risc0/zkp/prove/test/merkle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace risc0 {

void doTest(PsuedoRng& rng, size_t rowSize, size_t colSize, size_t queries) {
void doTest(PseudoRng& rng, size_t rowSize, size_t colSize, size_t queries) {
LOG(1, "Testing rowSize = " << rowSize << ", colSize = " << colSize << ", queries = " << queries);
// Make some leaves
auto leavesAccel = AccelSlice<Fp>::allocate(rowSize * colSize);
Expand Down Expand Up @@ -90,7 +90,7 @@ void doTest(PsuedoRng& rng, size_t rowSize, size_t colSize, size_t queries) {
}

TEST(Crypto, Merkle) {
PsuedoRng rng(2);
PseudoRng rng(2);
doTest(rng, 1, 1, 1);
doTest(rng, 4, 4, 2);
auto logish = [&]() {
Expand Down

0 comments on commit e0e39ed

Please sign in to comment.