Skip to content

Instantly share code, notes, and snippets.

import java.security.SecureRandom;
/**
* Created by ssitter on 6/27/14.
*/
object KeyGenerator {
private def spaceGenerator(len: Int, max: Int) : Array[Int] = {
val b = new Array[Byte](len);
new SecureRandom().nextBytes(b);
b map { x => (x & 0xff) % max }