Skip to content

Instantly share code, notes, and snippets.

View jeresuikkila's full-sized avatar
🌱

Jere Suikkila jeresuikkila

🌱
View GitHub Profile
// Jere Suikkila kehittänyt metodit:
// elossaOleviaNaapureita ja kehity
import java.util.Random;
public class GameOfLife {
private int[][] taulukko;
public GameOfLife(int leveys, int korkeus) {
# Solution to [2016-10-31] Challenge #290 [Easy] Kaprekar Numbers
# found at https://www.reddit.com/r/dailyprogrammer/comments/5aemnn/20161031_challenge_290_easy_kaprekar_numbers/
def isKaprekar(number):
'''
Tests every number in range for being a Kaprekar number as defined at
https://en.wikipedia.org/wiki/Kaprekar_number
'''
squared = number ** 2
str_squared = str(squared)
@jeresuikkila
jeresuikkila / train_test_split.rb
Last active August 21, 2016 17:48
Splitting an array to training and test sets for machine learning
def train_test_split(total_set, test_set_size = 0.25)
if test_set_size > 1.0
test_set_size = 1.0
elsif test_set_size < 0
test_set_size = 0.0
end
test_set_count = (total_set.length * test_set_size).floor