This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clearscreen repeat 360 [fd repcount rt repcount] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function digit_product(number) { | |
let digit_product = 1; | |
while (number) { | |
digit_product *= number % 10; | |
number = Math.floor(number / 10); | |
} | |
return digit_product; | |
} | |
function persistence(number) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is free and unencumbered software released into the public domain. | |
Anyone is free to copy, modify, publish, use, compile, sell, or | |
distribute this software, either in source code form or as a compiled | |
binary, for any purpose, commercial or non-commercial, and by any | |
means. | |
In jurisdictions that recognize copyright laws, the author or authors | |
of this software dedicate any and all copyright interest in the | |
software to the public domain. We make this dedication for the benefit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const percentateOfErrorsToLog = 30; | |
const percentateOfErrorsToLogFraction = percentateOfErrorsToLog/100; | |
const threshold = 1 - percentateOfErrorsToLogFraction; | |
try { | |
someErrorCasuingFunction(); | |
} | |
catch(error) { | |
if(Math.random() >= threshold) { | |
Sentry.captureException(error); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkUniformDistributionOfRandom(percentateOfErrorsToLog = 10) { | |
const percentateOfErrorsToLogFraction = percentateOfErrorsToLog/100; | |
const threshold = 1 - percentateOfErrorsToLogFraction; | |
const numberOfLoops = 1000; | |
for (let i=1; i<numberOfLoops; i++){ | |
if (Math.random() >= threshold) console.log("This should be printed " + percentateOfErrorsToLogFraction * numberOfLoops + " times"); | |
} | |
} | |
[10, 20, 30, 40, 50, 60, 70, 80, 90].map(checkUniformDistributionOfRandom); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
function recuresiveDigitSumMaths(number) { | |
finalRecuresiveDigitSum = 0; | |
while (number) { | |
digit = number % 10; | |
finalRecuresiveDigitSum += digit; | |
if (finalRecuresiveDigitSum > 9) finalRecuresiveDigitSum -= 9; | |
number = (number - digit) / 10 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
function recuresiveSum(number){ | |
finalRecursiveSum = 0; | |
while(number){ | |
digit = number % 10; | |
finalRecursiveSum += digit; | |
if (finalRecursiveSum>9) finalRecursiveSum -=9; | |
number = (number-digit)/10 | |
} | |
return (finalRecursiveSum); |
NewerOlder