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 samples = []; | |
sampleSize = 5; | |
records = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | |
records.forEach((record, index) => { | |
if (samples.length < sampleSize) { | |
samples.push(record); | |
} else { | |
let rand = Math.floor(Math.random() * index); | |
if (rand < sampleSize) { |
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
package com.noppanit; | |
import com.fasterxml.jackson.annotation.JsonAutoDetect; | |
import com.fasterxml.jackson.annotation.JsonInclude; | |
import com.fasterxml.jackson.core.JsonProcessingException; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import org.junit.Test; | |
import java.io.Serializable; | |
import java.util.HashMap; |
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
#!/bin/sh | |
#Credit: https://linuxprograms.wordpress.com/2007/06/17/shell-script-to-recursively-list-files/ | |
DIR="." | |
count=1 | |
function list_files() | |
{ | |
if !(test -d "$1") |