Skip to content

Instantly share code, notes, and snippets.

View Ranzeplay's full-sized avatar
🥰
Struggling to learn math and computer science

Jeb Feng Ranzeplay

🥰
Struggling to learn math and computer science
View GitHub Profile
import java.util.Random;
public class Main {
public static void main(String[] args) {
for(var a = 0; a < 100; a++) {
int count = 0;
for (var i = 0; i < 20000; i++) {
var x = new Random().doubles(0, 2).findFirst().getAsDouble();
var y = new Random().doubles(0, 2).findFirst().getAsDouble();
@Ranzeplay
Ranzeplay / addition.cpp
Last active October 6, 2021 13:56
Big number calculation
std::string add(std::string augend, std::string addend)
{
// Reverse two numbers, make them 0-index aligned
std::reverse(augend.begin(), augend.end());
std::reverse(addend.begin(), addend.end());
std::string result;
auto max_length = std::max(augend.size(), addend.size());
// To mark if there's a carry