Index: cpp/frams/_demos/genomanipulation.cpp
===================================================================
--- cpp/frams/_demos/genomanipulation.cpp	(revision 895)
+++ cpp/frams/_demos/genomanipulation.cpp	(revision 896)
@@ -1,4 +1,4 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
@@ -47,5 +47,5 @@
 	printf("      Current value of '%s' (%s) is '%s'\n", pi.id(i), pi.name(i), pi.get(i).c_str());
 	char t[100];
-	sprintf(t, "%g", minprop + (rnd01)*(maxprop - minprop));
+	sprintf(t, "%g", minprop + rndDouble(maxprop - minprop));
 	printf("      Setting new value... [ using ParamInterface::set() ]\n");
 	pi.setFromString(i, t);
Index: cpp/frams/canvas/nn_simple_layout.cpp
===================================================================
--- cpp/frams/canvas/nn_simple_layout.cpp	(revision 895)
+++ cpp/frams/canvas/nn_simple_layout.cpp	(revision 896)
@@ -1,4 +1,4 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
@@ -26,5 +26,5 @@
 	for (i = 0; i < N; i++)
 	{
-		nn->SetXYWH(i, (int)rnd0N(300), (int)rnd0N(300), 50, 50);
+		nn->SetXYWH(i, rndUint(300), rndUint(300), 50, 50);
 	}
 }
Index: cpp/frams/genetics/f4/f4_general.cpp
===================================================================
--- cpp/frams/genetics/f4/f4_general.cpp	(revision 895)
+++ cpp/frams/genetics/f4/f4_general.cpp	(revision 896)
@@ -1210,5 +1210,5 @@
 	int n = count();
 	// pick a random node, between 0 and n-1
-	return ordNode(randomN(n));
+	return ordNode(rndUint(n));
 }
 
@@ -1355,5 +1355,5 @@
 {
 	int i, j, res, t;
-	char tc1, tc2, tc3; // tc3 is only to ensure that in the end  of neuron parameter definition
+	char tc1, tc2, tc3; // tc3 is only to ensure that neuron parameter definition is completed
 	int relfrom;
 	double w;
Index: cpp/frams/genetics/f4/f4_oper.cpp
===================================================================
--- cpp/frams/genetics/f4/f4_oper.cpp	(revision 895)
+++ cpp/frams/genetics/f4/f4_oper.cpp	(revision 896)
@@ -158,5 +158,5 @@
 			// "X>" or "N>"
 			f4_node *n5 = NULL;
-			double pr = rnd01;
+			double pr = rndDouble(1);
 			pr -= 0.5;
 			if (pr < 0) n5 = new f4_node('X', n2, n2->pos);
@@ -204,5 +204,5 @@
 			n1->parent = n2;
 			// now with 50% chance swap children
-			if (randomN(2) == 0)
+			if (rndUint(2) == 0)
 			{
 				n3 = n2->child;
@@ -275,5 +275,5 @@
 			// choose a simple node from ADD_SIMPLE_CODES
 			n1->parent->removeChild(n1);
-			//f4_node *n2 = new f4_node(ADD_SIMPLE_CODES[randomN(strlen(ADD_SIMPLE_CODES))], n1->parent, n1->parent->pos);
+			//f4_node *n2 = new f4_node(ADD_SIMPLE_CODES[rndUint(strlen(ADD_SIMPLE_CODES))], n1->parent, n1->parent->pos);
 			int modifierid = GenoOperators::getRandomChar(all_modifiers, excluded_modifiers.c_str());
 			f4_node *n2 = new f4_node(all_modifiers[modifierid], n1->parent, n1->parent->pos);
@@ -333,5 +333,5 @@
 				n2->removeChild(n1);
 				// n1 has two children. pick one randomly 50-50, destroy other
-				if (randomN(2) == 0)
+				if (rndUint(2) == 0)
 				{
 					n1->child->parent = n2;
@@ -429,5 +429,5 @@
 
 	// 35% chance one of *GTS
-	prob1 = rnd01;
+	prob1 = rndDouble(1);
 	prob1 -= 0.35f;
 	if (prob1 < 0)
@@ -468,5 +468,5 @@
 	case 0: // change type
 		// 80% for link, 20% for random sensor
-		if (rnd01 < 0.2f)
+		if (rndDouble(1) < 0.2f)
 		{
 			cl = GenoOperators::getRandomNeuroClassWithOutputAndNoInputs();
@@ -497,6 +497,6 @@
 void Geno_f4::nparNodeMakeRandom(f4_node *nn) const
 {
-	int sign = (int)(2.0f * rnd01);
-	int param = (int)(3.0f * rnd01);
+	int sign = (int)rndDouble(2);
+	int param = (int)rndDouble(3);
 	if (param > 2) param = 2;
 	nn->l1 = sign;
@@ -512,5 +512,5 @@
 	// change count
 	count = nn->i1;
-	prob1 = rnd01;
+	prob1 = rndDouble(1);
 	if (prob1 < 0.5f) count++;
 	else count--;
@@ -699,6 +699,6 @@
 	// decide amounts of crossover, 0.25-0.75
 	// adam: seems 0.1-0.9 -- MacKo
-	chg1 = 0.1f + 0.8f*rnd01;
-	chg2 = 0.1f + 0.8f*rnd01;
+	chg1 = 0.1 + rndDouble(0.8);
+	chg2 = 0.1 + rndDouble(0.8);
 
 	copy1 = root1.duplicate();
Index: cpp/frams/genetics/f9/f9_oper.cpp
===================================================================
--- cpp/frams/genetics/f9/f9_oper.cpp	(revision 895)
+++ cpp/frams/genetics/f9/f9_oper.cpp	(revision 896)
@@ -5,5 +5,5 @@
 #include "f9_oper.h"
 #include "f9_conv.h"
-#include <common/nonstd.h> //randomN, rnd01
+#include <common/nonstd.h> //rndUint, rnd01
 
 
@@ -55,21 +55,21 @@
 	for (int i = 0; i < len; i++)
 	{
-		if (rnd01 < mut_prob) //normalize prob with the length of the genotype
+		if (rndDouble(1) < mut_prob) //normalize prob with the length of the genotype
 		{
 			char oldgene = gene[i];
-			gene[i] = turtle_commands_f9[randomN(symbols)];
+			gene[i] = turtle_commands_f9[rndUint(symbols)];
 			if (gene[i] != oldgene) changes++;
 		}
 	}
 
-	if (rnd01 < mut_prob) //add or delete a random char
+	if (rndDouble(1) < mut_prob) //add or delete a random char
 	{
 		SString newgeno(gene);
-		if (randomN(2) == 0) //add
+		if (rndUint(2) == 0) //add
 		{
 			int symbols = strlen(turtle_commands_f9);
-			int p = randomN(len + 1);  //random location
+			int p = rndUint(len + 1);  //random location
 			//printf("before add: %s\n",(const char*)newgeno);
-			newgeno = newgeno.substr(0, p) + SString(turtle_commands_f9 + randomN(symbols), 1) + newgeno.substr(p);
+			newgeno = newgeno.substr(0, p) + SString(turtle_commands_f9 + rndUint(symbols), 1) + newgeno.substr(p);
 			//printf("after add: %s\n",(const char*)newgeno);
 			changes++;
@@ -77,5 +77,5 @@
 		else if (len > 1) //delete
 		{
-			int p = randomN(len);  //random location
+			int p = rndUint(len);  //random location
 			//printf("before delete: %s\n",(const char*)newgeno);
 			newgeno = newgeno.substr(0, p) + newgeno.substr(p + 1);
@@ -95,6 +95,6 @@
 {
 	int len1 = strlen(g1), len2 = strlen(g2);
-	int p1 = randomN(len1);  //random cut point for first genotype
-	int p2 = randomN(len2);  //random cut point for second genotype
+	int p1 = rndUint(len1);  //random cut point for first genotype
+	int p2 = rndUint(len2);  //random cut point for second genotype
 	char *child1 = (char*)malloc(p1 + len2 - p2 + 1);
 	char *child2 = (char*)malloc(p2 + len1 - p1 + 1);
Index: cpp/frams/genetics/fB/fB_oper.cpp
===================================================================
--- cpp/frams/genetics/fB/fB_oper.cpp	(revision 895)
+++ cpp/frams/genetics/fB/fB_oper.cpp	(revision 896)
@@ -246,5 +246,5 @@
 	{
 		std::list<SString> tokenized = tokenizeSequence(line);
-		int rndid = randomN(tokenized.size()); // select random letter from genotype
+		int rndid = rndUint(tokenized.size()); // select random letter from genotype
 		// increment/decrement character - when overflow happens, this method
 		// uses reflect method
@@ -254,5 +254,5 @@
 		if ((*it).len() == 1)
 		{
-			if (randomN(2) == 0)
+			if (rndUint(2) == 0)
 			{
 				if ((*it)[0] == 'a') (*it).directWrite()[0] = 'b';
@@ -285,5 +285,5 @@
 		std::list<SString> tokenized = tokenizeSequence(line);
 		std::list<SString>::iterator it = tokenized.begin();
-		int rndid = randomN(tokenized.size()); // select random insertion point
+		int rndid = rndUint(tokenized.size()); // select random insertion point
 		std::advance(it, rndid);
 		NeuroClass *cls = getRandomNeuroClass();
@@ -306,9 +306,9 @@
 		chg = 1.0 / line.len();
 		std::list<SString> tokenized = tokenizeSequence(line);
-		int rndid = randomN(tokenized.size()); // select random insertion point
+		int rndid = rndUint(tokenized.size()); // select random insertion point
 		std::list<SString>::iterator it = tokenized.begin();
 		std::advance(it, rndid);
 		SString letter = "a";
-		letter.directWrite()[0] = 'a' + randomN(26);
+		letter.directWrite()[0] = 'a' + rndUint(26);
 		tokenized.insert(it, letter);
 		line = detokenizeSequence(&tokenized);
@@ -320,5 +320,5 @@
 		std::list<SString> tokenized = tokenizeSequence(line);
 		std::list<SString>::iterator it = tokenized.begin();
-		int rndid = randomN(tokenized.size()); // select random deletion point
+		int rndid = rndUint(tokenized.size()); // select random deletion point
 		std::advance(it, rndid);
 		tokenized.erase(it);
@@ -328,5 +328,5 @@
 	case FB_DUPLICATION:
 	{
-		int rndgene = randomN(fB_GenoHelpers::geneCount(line));
+		int rndgene = rndUint(fB_GenoHelpers::geneCount(line));
 		int start, end;
 		SString gene = fB_GenoHelpers::getGene(rndgene, line, start, end);
@@ -342,5 +342,5 @@
 		for (int i = 0; i < 4; i++)
 		{
-			cuts[i] = randomN(tokenized.size());
+			cuts[i] = rndUint(tokenized.size());
 		}
 		std::sort(cuts.begin(), cuts.end());
@@ -407,5 +407,5 @@
 	{
 		// get random gene from first parent
-		int choice = randomN(fB_GenoHelpers::geneCount(parent1));
+		int choice = rndUint(fB_GenoHelpers::geneCount(parent1));
 		int start, end;
 		SString gene = fB_GenoHelpers::getGene(choice, parent1, start, end);
@@ -414,5 +414,5 @@
 		chg2 = (float)parent2.len() / (float)child2.len();
 		// do the same for second parent
-		choice = randomN(fB_GenoHelpers::geneCount(parent2));
+		choice = rndUint(fB_GenoHelpers::geneCount(parent2));
 		gene = fB_GenoHelpers::getGene(choice, parent2, start, end);
 		child1 = gene + parent1;
@@ -428,5 +428,5 @@
 	//			int start, end;
 	//			SString gene = fB_GenoHelpers::getGene(i, parent1, start, end);
-	//			if (randomN(2) == 0)
+	//			if (rndUint(2) == 0)
 	//			{
 	//				child1 += gene;
@@ -445,5 +445,5 @@
 	//			int start, end;
 	//			SString gene = fB_GenoHelpers::getGene(i, parent2, start, end);
-	//			if (randomN(2) == 0)
+	//			if (rndUint(2) == 0)
 	//			{
 	//				child1 += gene;
@@ -474,5 +474,5 @@
 				i < fB_GenoHelpers::geneCountNoNested(parent2))
 			{
-				if (randomN(2) == 0)
+				if (rndUint(2) == 0)
 				{
 					to1 = fB_GenoHelpers::getNonNestedGene(i, parent1, start, end);
@@ -489,5 +489,5 @@
 			else if (i < fB_GenoHelpers::geneCountNoNested(parent1))
 			{
-				if (randomN(2) == 0)
+				if (rndUint(2) == 0)
 				{
 					to1 = fB_GenoHelpers::getNonNestedGene(i, parent1, start, end);
@@ -501,5 +501,5 @@
 			else // if (i < fB_GenoHelpers::geneCountNoNested(parent2))
 			{
-				if (randomN(2) == 0)
+				if (rndUint(2) == 0)
 				{
 					to1 = fB_GenoHelpers::getNonNestedGene(i, parent2, start, end);
Index: cpp/frams/genetics/fF/fF_oper.cpp
===================================================================
--- cpp/frams/genetics/fF/fF_oper.cpp	(revision 895)
+++ cpp/frams/genetics/fF/fF_oper.cpp	(revision 896)
@@ -1,9 +1,9 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
 #include "fF_oper.h"
 #include "fF_genotype.h"
-#include <common/nonstd.h> //randomN, rnd01
+#include <common/nonstd.h> //rndUint, rnd01
 
 
@@ -49,5 +49,5 @@
 	par.load(gene);
 	static const int propsToMutate[] = fF_PROPS_TO_MUTATE;
-	int which = randomN(ARRAY_LENGTH(propsToMutate));
+	int which = rndUint(ARRAY_LENGTH(propsToMutate));
 	bool mutated_ok = GenoOperators::mutatePropertyNaive(par.param, propsToMutate[which]);
 	if (mutated_ok)
Index: cpp/frams/genetics/fH/fH_oper.cpp
===================================================================
--- cpp/frams/genetics/fH/fH_oper.cpp	(revision 895)
+++ cpp/frams/genetics/fH/fH_oper.cpp	(revision 896)
@@ -107,5 +107,5 @@
 	for (unsigned int i = 0; i < parent1->sticks.size(); i++)
 	{
-		if (randomN(2) == 0)
+		if (rndUint(2) == 0)
 		{
 			child1->sticks.push_back(parent1->sticks[i]);
@@ -120,5 +120,5 @@
 	for (unsigned int i = 0; i < parent2->sticks.size(); i++)
 	{
-		if (randomN(2) == 0)
+		if (rndUint(2) == 0)
 		{
 			child1->sticks.push_back(parent2->sticks[i]);
@@ -140,5 +140,5 @@
 	for (unsigned int i = 0; i < parent1->neurons.size(); i++)
 	{
-		if ((randomN(2) == 0 || skip2) && !skip1)
+		if ((rndUint(2) == 0 || skip2) && !skip1)
 		{
 			child1->neurons.push_back(parent1->neurons[i]);
@@ -153,5 +153,5 @@
 	for (unsigned int i = 0; i < parent2->neurons.size(); i++)
 	{
-		if ((randomN(2) == 0 || skip2) && !skip1)
+		if ((rndUint(2) == 0 || skip2) && !skip1)
 		{
 			child1->neurons.push_back(parent2->neurons[i]);
@@ -166,5 +166,5 @@
 	for (unsigned int i = 0; i < parent1->connections.size(); i++)
 	{
-		if ((randomN(2) == 0 || skip2) && !skip1)
+		if ((rndUint(2) == 0 || skip2) && !skip1)
 		{
 			child1->connections.push_back(parent1->connections[i]);
@@ -179,5 +179,5 @@
 	for (unsigned int i = 0; i < parent2->connections.size(); i++)
 	{
-		if ((randomN(2) == 0 || skip2) && !skip1)
+		if ((rndUint(2) == 0 || skip2) && !skip1)
 		{
 			child1->connections.push_back(parent2->connections[i]);
@@ -338,5 +338,5 @@
 	if (changedimensions)
 	{
-		int i = randomN(2 * dimensions);
+		int i = rndUint(2 * dimensions);
 		changeDoubleProperty(i, par, handle->type);
 	}
@@ -344,5 +344,5 @@
 	if (changeproperties)
 	{
-		int i = 2 * dimensions + randomN(par.getPropCount() - 2 * dimensions);
+		int i = 2 * dimensions + rndUint(par.getPropCount() - 2 * dimensions);
 		changeDoubleProperty(i, par, handle->type);
 	}
@@ -360,11 +360,11 @@
 	for (int i = 0; i < dimensions; i++)
 	{
-		par.setDouble(i, min + rnd0N(max - min));
-		par.setDouble(i + dimensions, min + rnd0N(max - min));
+		par.setDouble(i, min + rndDouble(max - min));
+		par.setDouble(i + dimensions, min + rndDouble(max - min));
 	}
 	handle->loadProperties(par);
 	if (handle->type != fHBodyType::NEURON)
 	{
-		int i = 2 * dimensions + randomN(par.getPropCount() - 2 * dimensions);
+		int i = 2 * dimensions + rndUint(par.getPropCount() - 2 * dimensions);
 		changeDoubleProperty(i, par, handle->type);
 	}
@@ -406,5 +406,5 @@
 		allhandlescount += creature->sticks.size();
 	}
-	unsigned int toselect = randomN(allhandlescount);
+	unsigned int toselect = rndUint(allhandlescount);
 	if (toselect < creature->connections.size())
 	{
@@ -436,5 +436,5 @@
 	if (par.getPropCount() > 0)
 	{
-		int i = randomN(par.getPropCount());
+		int i = rndUint(par.getPropCount());
 		if (*par.type(i) == 'f')
 		{
Index: cpp/frams/genetics/fL/fL_matheval.cpp
===================================================================
--- cpp/frams/genetics/fL/fL_matheval.cpp	(revision 895)
+++ cpp/frams/genetics/fL/fL_matheval.cpp	(revision 896)
@@ -613,5 +613,5 @@
 void MathEvaluation::mutateValueOrVariable(MathEvaluation::Number *&currval, bool usetime)
 {
-	if (randomN(2) == 0 && varcount > 0) // use variable
+	if (rndUint(2) == 0 && varcount > 0) // use variable
 	{
 		if (currval && currval->type == TokenType::NUMBER)
@@ -619,5 +619,5 @@
 			delete currval;
 		}
-		int var = randomN(varcount + (usetime ? 1 : 0));
+		int var = rndUint(varcount + (usetime ? 1 : 0));
 		if (varcount == var) // time is used
 		{
@@ -633,9 +633,9 @@
 		if (!currval || currval->type == TokenType::VARIABLE)
 		{
-			currval = new Number(rnd01);
+			currval = new Number(rndDouble(1));
 		}
 		else
 		{
-			currval->value = rnd01;
+			currval->value = rndDouble(1);
 		}
 	}
@@ -654,5 +654,5 @@
 		count = operatorstrings.size() - arithmeticoperatorscount;
 	}
-	randop += randomN(count);
+	randop += rndUint(count);
 	return operators[operatorstrings[randop]];
 }
@@ -663,9 +663,9 @@
 	{
 		int currsize = postfixlist.size();
-		int varid = randomN(varcount);
+		int varid = rndUint(varcount);
 		postfixlist.push_back(vars[varid]);
-		if (randomN(2) == 0 && varcount > 1)
-		{
-			int varid2 = randomN(varcount - 1);
+		if (rndUint(2) == 0 && varcount > 1)
+		{
+			int varid2 = rndUint(varcount - 1);
 			if (varid2 >= varid) varid2++;
 			postfixlist.push_back(vars[varid2]);
@@ -673,8 +673,8 @@
 		else
 		{
-			Number *num = new Number(rnd01);
+			Number *num = new Number(rndDouble(1));
 			postfixlist.push_back(num);
 		}
-		int opid = arithmeticoperatorscount + randomN(comparisonoperatorscount);
+		int opid = arithmeticoperatorscount + rndUint(comparisonoperatorscount);
 		postfixlist.push_back(operators[operatorstrings[opid]]);
 		if (currsize > 0)
@@ -689,9 +689,9 @@
 	if (postfixlist.size() == 0)
 	{
-		Number *val = new Number(rnd01);
+		Number *val = new Number(rndDouble(1));
 		postfixlist.push_back(val);
 		return -1;
 	}
-	int method = randomN(postfixlist.size() < MAX_MUT_FORMULA_SIZE ? MATH_MUT_COUNT : MATH_MUT_COUNT - 1);
+	int method = rndUint(postfixlist.size() < MAX_MUT_FORMULA_SIZE ? MATH_MUT_COUNT : MATH_MUT_COUNT - 1);
 	switch (method)
 	{
@@ -704,5 +704,5 @@
 		std::list<Token *>::iterator it = postfixlist.begin();
 		// insertion can be applied from 1st occurrence
-		int insertlocation = 1 + randomN(postfixlist.size() - 1);
+		int insertlocation = 1 + rndUint(postfixlist.size() - 1);
 		std::advance(it, insertlocation);
 		Operator *rndop;
@@ -732,5 +732,5 @@
 			id++;
 		}
-		int randid = randomN(numbersineval.size());
+		int randid = rndUint(numbersineval.size());
 		Number *numptr = (Number *)(*numbersineval[randid]);
 		mutateValueOrVariable(numptr, usetime);
@@ -750,5 +750,5 @@
 		if (ops.size() > 0)
 		{
-			int randid = randomN(ops.size());
+			int randid = rndUint(ops.size());
 			Operator *rndop;
 			if (randid == (int)ops.size() - 1)
@@ -783,5 +783,5 @@
 		if (firstofpairs.size() > 0)
 		{
-			int rndid = randomN(firstofpairs.size());
+			int rndid = rndUint(firstofpairs.size());
 			if ((*firstofpairs[rndid])->type == TokenType::NUMBER)
 			{
Index: cpp/frams/genetics/fL/fL_oper.cpp
===================================================================
--- cpp/frams/genetics/fL/fL_oper.cpp	(revision 895)
+++ cpp/frams/genetics/fL/fL_oper.cpp	(revision 896)
@@ -133,5 +133,5 @@
 		if (newword->name.startsWith("rot"))
 		{
-			double rot = 2 * rnd01;
+			double rot = rndDouble(2);
 			MathEvaluation *eval = new MathEvaluation(0);
 			eval->convertString(SString::valueOf(rot).c_str());
@@ -149,5 +149,5 @@
 		{
 			MathEvaluation *eval = new MathEvaluation(0);
-			eval->convertString(SString::valueOf(2 * rnd01 - 1).c_str());
+			eval->convertString(SString::valueOf(rndDouble(2) - 1).c_str());
 			newword->parevals[0] = eval;
 		}
@@ -171,5 +171,5 @@
 	else
 	{
-		int rid = randomN(creature->rules.size());
+		int rid = rndUint(creature->rules.size());
 		list = &creature->rules[rid]->objsucc;
 		numparams = creature->rules[rid]->objpred->npar;
@@ -183,5 +183,5 @@
 	if (method == FL_ADD_OTHER && creature->builtincount < (int)creature->words.size())
 	{
-		return creature->words[creature->wordnames[creature->builtincount + randomN((int)creature->words.size() - creature->builtincount)]];
+		return creature->words[creature->wordnames[creature->builtincount + rndUint((int)creature->words.size() - creature->builtincount)]];
 	}
 	else
@@ -209,5 +209,5 @@
 		case FL_ADD_ROT:
 		{
-			int rottype = randomN(3);
+			int rottype = rndUint(3);
 			switch (rottype)
 			{
@@ -287,5 +287,5 @@
 		case FL_CHG_ITER:
 		{
-			if (randomN(2) == 0)
+			if (rndUint(2) == 0)
 			{
 				creature->time = creature->time + iterchangestep <= ExtValue::getDouble(FL_MAXITER) ?
@@ -303,5 +303,5 @@
 			if (creature->rules.size() > 0)
 			{
-				int ruleid = randomN(creature->rules.size());
+				int ruleid = rndUint(creature->rules.size());
 				if (!creature->rules[ruleid]->condeval)
 				{
@@ -340,5 +340,5 @@
 			if (wordswithnorules.size() > 0)
 			{
-				int predid = randomN(wordswithnorules.size());
+				int predid = rndUint(wordswithnorules.size());
 				fL_Rule *newrule = new fL_Rule(0,0);
 				fL_Word *pred = new fL_Word();
@@ -352,5 +352,5 @@
 			else if (creature->rules.size() > 0)
 			{
-				int ruleid = randomN(creature->rules.size());
+				int ruleid = rndUint(creature->rules.size());
 				fL_Rule *newrule = new fL_Rule(0, 0);
 				fL_Word *pred = new fL_Word();
@@ -392,5 +392,5 @@
 			if (creature->countDefinedWords() <= maxdefinedwords)
 			{
-				int npar = randomN(ExtValue::getInt(FL_MAXPARAMS, false));
+				int npar = rndUint(ExtValue::getInt(FL_MAXPARAMS, false));
 				for (int i = 0; i < maxdefinedwords; i++)
 				{
@@ -421,5 +421,5 @@
 				if (list->size() > 1)
 				{
-					int rndid = randomN(list->size() - 1);
+					int rndid = rndUint(list->size() - 1);
 					int j = 0;
 					std::list<fL_Word *>::iterator it = list->begin();
@@ -455,5 +455,5 @@
 			else
 			{
-				int rndid = randomN(list->size());
+				int rndid = rndUint(list->size());
 				std::list<fL_Word *>::iterator it = list->begin();
 				std::advance(it, rndid);
@@ -482,5 +482,5 @@
 			int tmp = 0;
 			std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, tmp);
-			int rndid = randomN(list->size());
+			int rndid = rndUint(list->size());
 			std::list<fL_Word *>::iterator it = list->begin();
 			std::advance(it, rndid);
@@ -512,5 +512,5 @@
 				fL_Branch *start = new fL_Branch(fL_Branch::BranchType::OPEN, 0, 0);
 				list->insert(it, start);
-				int rottype = randomN(2);
+				int rottype = rndUint(2);
 				switch (rottype)
 				{
@@ -531,5 +531,5 @@
 			int tmp = 0;
 			std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, tmp);
-			int rndid = randomN(list->size());
+			int rndid = rndUint(list->size());
 			std::list<fL_Word *>::iterator selectedword = list->begin();
 			std::advance(selectedword, rndid);
@@ -545,5 +545,5 @@
 				int numpars = 0;
 				std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, tmp);
-				int rndid = randomN(list->size());
+				int rndid = rndUint(list->size());
 				std::list<fL_Word *>::iterator it = list->begin();
 				std::advance(it, rndid);
@@ -577,5 +577,5 @@
 					if (available.size() > 0)
 					{
-						int newnameid = randomN(available.size());
+						int newnameid = rndUint(available.size());
 						(*selectedword)->name = available[newnameid]->name;
 					}
@@ -593,5 +593,5 @@
 				if ((*selectedword)->npar > 0)
 				{
-					int randeval = randomN((*selectedword)->npar);
+					int randeval = rndUint((*selectedword)->npar);
 					Param par((*selectedword)->tab, (*selectedword)->data);
 					if ((*selectedword)->builtin && (*selectedword)->name == "N"
@@ -614,5 +614,5 @@
 							if (w->npar > 0)
 							{
-								int rndattr = randomN(w->npar);
+								int rndattr = rndUint(w->npar);
 								if (!w->parevals[rndattr])
 								{
@@ -638,5 +638,5 @@
 								if (w->npar > 0)
 								{
-									int rndattr = randomN(w->npar);
+									int rndattr = rndUint(w->npar);
 									for (int i = 0; i < w->npar; i++)
 									{
@@ -752,5 +752,5 @@
 		for (int i = 0; i < numselrules; i++)
 		{
-			int rulid = randomN(from->rules.size());
+			int rulid = rndUint(from->rules.size());
 			fL_Rule *rul = from->rules[rulid];
 			fL_Rule *newrule = new fL_Rule(0, 0);
@@ -841,10 +841,10 @@
 	creature2template->parseGenotype(g2);
 
-	int numselrules = 1 + randomN(XOVER_MAX_MIGRATED_RULES);
+	int numselrules = 1 + rndUint(XOVER_MAX_MIGRATED_RULES);
 	numselrules = numselrules < (int)creature1->rules.size() ? numselrules : (int)creature1->rules.size();
 
 	migrateRandomRules(creature1template, creature2, numselrules);
 
-	numselrules = 1 + randomN(XOVER_MAX_MIGRATED_RULES);
+	numselrules = 1 + rndUint(XOVER_MAX_MIGRATED_RULES);
 	numselrules = numselrules < (int)creature1->rules.size() ? numselrules : (int)creature1->rules.size();
 
Index: cpp/frams/genetics/fT/fTest_oper.cpp
===================================================================
--- cpp/frams/genetics/fT/fTest_oper.cpp	(revision 895)
+++ cpp/frams/genetics/fT/fTest_oper.cpp	(revision 896)
@@ -1,4 +1,4 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
@@ -88,7 +88,7 @@
 	int changes = 0, len = strlen(geno);
 	for (int i = 0; i < len; i++)
-		if (rnd01 < prob) //normalize prob with length of genotype
+		if (rndDouble(1) < prob) //normalize prob with length of genotype
 		{
-			geno[i] = a[randomN(4)];
+			geno[i] = a[rndUint(4)];
 			changes++;
 		}
@@ -101,6 +101,6 @@
 {
 	int len1 = strlen(g1), len2 = strlen(g2);
-	int p1 = randomN(len1);  //random cut point for first genotype
-	int p2 = randomN(len2);  //random cut point for second genotype
+	int p1 = rndUint(len1);  //random cut point for first genotype
+	int p2 = rndUint(len2);  //random cut point for second genotype
 	char *child1 = (char*)malloc(p1 + len2 - p2 + 1);
 	char *child2 = (char*)malloc(p2 + len1 - p1 + 1);
Index: cpp/frams/genetics/fn/fn_oper.cpp
===================================================================
--- cpp/frams/genetics/fn/fn_oper.cpp	(revision 895)
+++ cpp/frams/genetics/fn/fn_oper.cpp	(revision 896)
@@ -5,5 +5,5 @@
 #include "fn_oper.h"
 #include "fn_conv.h"
-#include <common/nonstd.h> //randomN, rnd01
+#include <common/nonstd.h> //rndUint, rnd01
 
 
@@ -80,5 +80,5 @@
 	if (mut_single_var) //mutate only one, randomly selected variable
 	{
-		int which = randomN(values.size());
+		int which = rndUint(values.size());
 		values[which] = GenoOperators::mutateCreep('f', values[which], bound_low[which], bound_high[which], stddev[which], false);
 		chg = 1.0f / values.size();
@@ -103,5 +103,5 @@
 	//xover_proportion = 0.1; //testing...
 
-	double proportion = xover_proportion_random ? 0.5 + rnd0N(0.5) : xover_proportion;
+	double proportion = xover_proportion_random ? 0.5 + rndDouble(0.5) : xover_proportion;
 
 	chg1 = proportion;
Index: cpp/frams/genetics/genman.cpp
===================================================================
--- cpp/frams/genetics/genman.cpp	(revision 895)
+++ cpp/frams/genetics/genman.cpp	(revision 896)
@@ -362,5 +362,5 @@
 		{
 			char *gn;
-			if (g1n[0] && g2n[0]) if (randomN(2) == 0) g1n[0] = 0; else g2n[0] = 0; //both provided? we want only one
+			if (g1n[0] && g2n[0]) if (rndUint(2) == 0) g1n[0] = 0; else g2n[0] = 0; //both provided? we want only one
 			if (g1n[0]) { gn = g1n; chg = chg1; }
 			else { gn = g2n; chg = chg2; }
Index: cpp/frams/genetics/genooperators.cpp
===================================================================
--- cpp/frams/genetics/genooperators.cpp	(revision 895)
+++ cpp/frams/genetics/genooperators.cpp	(revision 896)
@@ -38,5 +38,5 @@
 	int i;
 	for (i = 0; i < count; i++) sum += probtab[i];
-	double sel = rnd01*sum;
+	double sel = rndDouble(sum);
 	for (sum = 0, i = 0; i < count; i++) { sum += probtab[i]; if (sel < sum) return i; }
 	return -1;
@@ -81,5 +81,5 @@
 		neucls = n->getClass() == NULL ? 0 : n->getClass()->getProperties().getPropCount();
 	if (neuext + neucls == 0) return -1; //no properties in this neuron
-	int index = randomN(neuext + neucls);
+	int index = rndUint(neuext + neucls);
 	if (index >= neuext) index = index - neuext + 100;
 	return index;
@@ -142,5 +142,5 @@
 	{
 		result = int(result + 0.5);
-		if (result == current) result += randomN(2) * 2 - 1; //force some change
+		if (result == current) result += rndUint(2) * 2 - 1; //force some change
 	}
 	else
@@ -238,5 +238,5 @@
 		if (Neuro::getClass(i)->genactive)
 			active.push_back(Neuro::getClass(i));
-	if (active.size() == 0) return NULL; else return active[randomN(active.size())];
+	if (active.size() == 0) return NULL; else return active[rndUint(active.size())];
 }
 
@@ -247,5 +247,5 @@
 		if (Neuro::getClass(i)->genactive && Neuro::getClass(i)->getPreferredOutput() != 0)
 			active.push_back(Neuro::getClass(i));
-	if (active.size() == 0) return NULL; else return active[randomN(active.size())];
+	if (active.size() == 0) return NULL; else return active[rndUint(active.size())];
 }
 
@@ -256,5 +256,5 @@
 		if (Neuro::getClass(i)->genactive && Neuro::getClass(i)->getPreferredInputs() != 0)
 			active.push_back(Neuro::getClass(i));
-	if (active.size() == 0) return NULL; else return active[randomN(active.size())];
+	if (active.size() == 0) return NULL; else return active[rndUint(active.size())];
 }
 
@@ -265,5 +265,5 @@
 		if (Neuro::getClass(i)->genactive && Neuro::getClass(i)->getPreferredOutput() != 0 && Neuro::getClass(i)->getPreferredInputs() == 0)
 			active.push_back(Neuro::getClass(i));
-	if (active.size() == 0) return NULL; else return active[randomN(active.size())];
+	if (active.size() == 0) return NULL; else return active[rndUint(active.size())];
 }
 
@@ -274,5 +274,5 @@
 		if (NClist[i]->getPreferredOutput() != 0) //this NeuroClass provides output
 			allowed.push_back(i);
-	if (allowed.size() == 0) return -1; else return allowed[randomN(allowed.size())];
+	if (allowed.size() == 0) return -1; else return allowed[rndUint(allowed.size())];
 }
 
@@ -283,5 +283,5 @@
 		if (NClist[i]->getPreferredInputs() != 0) //this NeuroClass wants one input connection or more			
 			allowed.push_back(i);
-	if (allowed.size() == 0) return -1; else return allowed[randomN(allowed.size())];
+	if (allowed.size() == 0) return -1; else return allowed[rndUint(allowed.size())];
 }
 
@@ -291,5 +291,5 @@
 	for (size_t i = 0; i < strlen(choices); i++) if (!strchrn0(excluded, choices[i])) allowed_count++;
 	if (allowed_count == 0) return -1; //no char is allowed
-	int rnd_index = randomN(allowed_count) + 1;
+	int rnd_index = rndUint(allowed_count) + 1;
 	allowed_count = 0;
 	for (size_t i = 0; i < strlen(choices); i++)
Index: cpp/frams/model/model.cpp
===================================================================
--- cpp/frams/model/model.cpp	(revision 895)
+++ cpp/frams/model/model.cpp	(revision 896)
@@ -1,4 +1,4 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
@@ -83,9 +83,9 @@
 	updateRefno();
 	if (using_checkpoints)
-		for (vector<Model*>::const_iterator it = mod.checkpoints.begin(); it != mod.checkpoints.end(); it++)
-		{
-		Model *m = *it;
-		Model *n = new Model(*m, m->autobuildmaps, false, true);
-		checkpoints.push_back(n);
+		for (vector<Model *>::const_iterator it = mod.checkpoints.begin(); it != mod.checkpoints.end(); it++)
+		{
+			Model *m = *it;
+			Model *n = new Model(*m, m->autobuildmaps, false, true);
+			checkpoints.push_back(n);
 		}
 }
@@ -152,9 +152,9 @@
 void Model::clear()
 {
-	FOREACH(Part*, p, parts)
+	FOREACH(Part *, p, parts)
 		delete p;
-	FOREACH(Joint*, j, joints)
+	FOREACH(Joint *, j, joints)
 		delete j;
-	FOREACH(Neuro*, n, neurons)
+	FOREACH(Neuro *, n, neurons)
 		delete n;
 	parts.clear(); joints.clear(); neurons.clear();
@@ -164,5 +164,5 @@
 	geno = Geno();
 	f0geno = Geno();
-	for (vector<Model*>::iterator it = checkpoints.begin(); it != checkpoints.end(); it++)
+	for (vector<Model *>::iterator it = checkpoints.begin(); it != checkpoints.end(); it++)
 		delete *it;
 	checkpoints.clear();
@@ -195,5 +195,5 @@
 void Model::removeNeuros(SList &nlist)
 {
-	FOREACH(Neuro*, nu, nlist)
+	FOREACH(Neuro *, nu, nlist)
 	{
 		int i = findNeuro(nu);
@@ -209,5 +209,5 @@
 		SList jlist;
 		findJoints(jlist, p);
-		FOREACH(Joint*, j, jlist)
+		FOREACH(Joint *, j, jlist)
 		{
 			int i = findJoint(j);
@@ -240,11 +240,11 @@
 void Model::removeNeuro(int neuroindex, bool removereferences)
 {
-	Neuro* thisN = getNeuro(neuroindex);
+	Neuro *thisN = getNeuro(neuroindex);
 
 	if (removereferences)
 	{
-		Neuro* n;
+		Neuro *n;
 		// remove all references to thisN
-		for (int i = 0; n = (Neuro*)neurons(i); i++)
+		for (int i = 0; n = (Neuro *)neurons(i); i++)
 		{
 			Neuro *inp;
@@ -252,6 +252,6 @@
 				if (inp == thisN)
 				{
-				n->removeInput(j);
-				j--;
+					n->removeInput(j);
+					j--;
 				}
 		}
@@ -262,5 +262,5 @@
 }
 
-MultiMap& Model::getMap()
+MultiMap &Model::getMap()
 {
 	if (!map) map = new MultiMap();
@@ -277,5 +277,5 @@
 }
 
-void Model::makeGenToGenMap(MultiMap& result, const MultiMap& gen1tomodel, const MultiMap& gen2tomodel)
+void Model::makeGenToGenMap(MultiMap &result, const MultiMap &gen1tomodel, const MultiMap &gen2tomodel)
 {
 	result.clear();
@@ -285,9 +285,9 @@
 }
 
-void Model::getCurrentToF0Map(MultiMap& result)
+void Model::getCurrentToF0Map(MultiMap &result)
 {
 	result.clear();
 	if (!map) return;
-	const MultiMap& f0m = getF0Map();
+	const MultiMap &f0m = getF0Map();
 	makeGenToGenMap(result, *map, f0m);
 }
@@ -312,12 +312,12 @@
 }
 
-Model::ItemType Model::itemTypeFromLinePrefix(const char* line)
-{
-	struct PrefixAndItem { const char* prefix; ItemType type; };
+Model::ItemType Model::itemTypeFromLinePrefix(const char *line)
+{
+	struct PrefixAndItem { const char *prefix; ItemType type; };
 	static const PrefixAndItem types[] = { { "m:", ModelType }, { "p:", PartType }, { "j:", JointType }, { "n:", NeuronType }, { "c:", NeuronConnectionType }, { F0_CHECKPOINT_LINE, CheckpointType }, { NULL } };
 	for (const PrefixAndItem *t = types; t->prefix != NULL; t++)
 	{
-		const char* in = line;
-		const char* pattern = t->prefix;
+		const char *in = line;
+		const char *pattern = t->prefix;
 		for (; *in == *pattern; in++, pattern++)
 			if (*pattern == ':')
@@ -355,5 +355,5 @@
 	for (; f0txt.getNextToken(pos, line, '\n'); lnum++)
 	{
-		const char* line_ptr = line.c_str();
+		const char *line_ptr = line.c_str();
 		for (; *line_ptr; line_ptr++)
 			if (!strchr(" \r\t", *line_ptr)) break;
@@ -361,5 +361,5 @@
 		if (!*line_ptr) continue;
 
-		const char* colon = strchr(line_ptr, ':');
+		const char *colon = strchr(line_ptr, ':');
 		ItemType type = UnknownType;
 		SString excluding_prefix;
@@ -414,5 +414,5 @@
 }
 
-const MultiMap& Model::getF0Map()
+const MultiMap &Model::getF0Map()
 {
 	if (!f0map)
@@ -472,5 +472,5 @@
 	}
 
-	for (i = 0; p = (Part*)parts(i); i++)
+	for (i = 0; p = (Part *)parts(i); i++)
 	{
 		partparam.select(p);
@@ -481,5 +481,5 @@
 			map->add(len, gen.len() - 1, partToMap(i));
 	}
-	for (i = 0; j = (Joint*)joints(i); i++)
+	for (i = 0; j = (Joint *)joints(i); i++)
 	{
 		jointparam.select(j);
@@ -491,5 +491,5 @@
 			map->add(len, gen.len() - 1, jointToMap(i));
 	}
-	for (i = 0; n = (Neuro*)neurons(i); i++)
+	for (i = 0; n = (Neuro *)neurons(i); i++)
 	{
 		neuroparam.select(n);
@@ -502,5 +502,5 @@
 	for (a = 0; a < neurons.size(); a++)
 	{ // inputs
-		n = (Neuro*)neurons(a);
+		n = (Neuro *)neurons(a);
 		//	if ((n->getInputCount()==1)&&(n->getInput(0).refno <= n->refno))
 		//		continue; // already done with Neuro::conn_refno
@@ -510,5 +510,5 @@
 			double w;
 			NeuroConn nc;
-			Neuro* n2 = n->getInput(b, w);
+			Neuro *n2 = n->getInput(b, w);
 			//		if (((n2.parentcount==1)&&(n2.parent)&&(n2.parent->refno < n2.refno)) ^ 
 			//		    (n2.neuro_refno>=0))
@@ -533,5 +533,5 @@
 	}
 
-	for (vector<Model*>::const_iterator it = checkpoints.begin(); it != checkpoints.end(); it++)
+	for (vector<Model *>::const_iterator it = checkpoints.begin(); it != checkpoints.end(); it++)
 	{
 		Geno g = (*it)->getF0Geno();
@@ -562,5 +562,5 @@
 }
 
-Model* Model::getCheckpoint(int i)
+Model *Model::getCheckpoint(int i)
 {
 	return checkpoints[i];
@@ -575,5 +575,5 @@
 }
 
-void Model::setGeno(const Geno& newgeno)
+void Model::setGeno(const Geno &newgeno)
 {
 	geno = newgeno;
@@ -586,9 +586,9 @@
 	delMap();
 	delF0Map();
-	for (i = 0; p = (Part*)parts(i); i++)
+	for (i = 0; p = (Part *)parts(i); i++)
 		p->clearMapping();
-	for (i = 0; j = (Joint*)joints(i); i++)
+	for (i = 0; j = (Joint *)joints(i); i++)
 		j->clearMapping();
-	for (i = 0; n = (Neuro*)neurons(i); i++)
+	for (i = 0; n = (Neuro *)neurons(i); i++)
 		n->clearMapping();
 }
@@ -607,11 +607,11 @@
 			Part *p; Joint *j; Neuro *n;
 			int i;
-			for (i = 0; p = (Part*)parts(i); i++)
+			for (i = 0; p = (Part *)parts(i); i++)
 				if (p->getMapping())
 					map->add(*p->getMapping(), partToMap(i));
-			for (i = 0; j = (Joint*)joints(i); i++)
+			for (i = 0; j = (Joint *)joints(i); i++)
 				if (j->getMapping())
 					map->add(*j->getMapping(), jointToMap(i));
-			for (i = 0; n = (Neuro*)neurons(i); i++)
+			for (i = 0; n = (Neuro *)neurons(i); i++)
 				if (n->getMapping())
 					map->add(*n->getMapping(), neuroToMap(i));
@@ -629,5 +629,5 @@
 }
 
-Pt3D Model::whereDelta(const Part& start, const Pt3D& rot, const Pt3D& delta)
+Pt3D Model::whereDelta(const Part &start, const Pt3D &rot, const Pt3D &delta)
 {
 	Orient roto;
@@ -641,10 +641,10 @@
 }
 
-int Model::addFromString(ItemType item_type, const SString &singleline, const MultiRange* srcrange)
+int Model::addFromString(ItemType item_type, const SString &singleline, const MultiRange *srcrange)
 {
 	return addFromString(item_type, singleline, 0, srcrange);
 }
 
-int Model::addFromString(ItemType item_type, const SString &singleline, int line_num, const MultiRange* srcrange)
+int Model::addFromString(ItemType item_type, const SString &singleline, int line_num, const MultiRange *srcrange)
 {
 	SString error_message;
@@ -654,5 +654,5 @@
 		if (error_message.len() == 0) // generic error when no detailed message is available
 			error_message = "Invalid f0 code";
-		if (line_num>0)
+		if (line_num > 0)
 			error_message += SString::sprintf(", line #%d", line_num);
 		error_message += nameForErrors();
@@ -662,5 +662,5 @@
 }
 
-int Model::addFromStringNoLog(ItemType item_type, const SString &line, SString& error_message, const MultiRange* srcrange)
+int Model::addFromStringNoLog(ItemType item_type, const SString &line, SString &error_message, const MultiRange *srcrange)
 {
 	error_message = SString::empty();
@@ -831,5 +831,5 @@
 SString Model::nameForErrors() const
 {
-	if (geno.getName().len()>0)
+	if (geno.getName().len() > 0)
 		return SString::sprintf(" in '%s'", geno.getName().c_str());
 	return SString::empty();
@@ -850,8 +850,8 @@
 	else
 	{
-		Pt3D bbmin = ((Part*)parts(0))->p, bbmax = bbmin;
+		Pt3D bbmin = ((Part *)parts(0))->p, bbmax = bbmin;
 		for (i = 0; i < parts.size(); i++)
 		{
-			p = (Part*)parts(i);
+			p = (Part *)parts(i);
 			p->owner = this;
 			if (checklevel > 0)
@@ -894,5 +894,5 @@
 		for (i = 0; i < joints.size(); i++)
 		{
-			j = (Joint*)joints(i);
+			j = (Joint *)joints(i);
 			// VALIDMINMAX are managed manually when adding joint properties in f0-def!
 			// (could be made dynamic but not really worth the effort)
@@ -979,5 +979,5 @@
 	for (i = 0; i < neurons.size(); i++)
 	{
-		n = (Neuro*)neurons(i);
+		n = (Neuro *)neurons(i);
 		n->part_refno = (n->part) ? n->part->refno : -1;
 		n->joint_refno = (n->joint) ? n->joint->refno : -1;
@@ -991,5 +991,5 @@
 			for (i = 0; i < parts.size(); i++)
 			{
-				p = (Part*)parts(i);
+				p = (Part *)parts(i);
 				if (p->mass <= 0.001)
 					p->mass = 1.0;
@@ -1003,8 +1003,8 @@
 				for (i = 0; i < joints.size(); i++)
 				{
-					j = (Joint*)joints(i);
-					if (j->part1->flags&LINKFLAG)
+					j = (Joint *)joints(i);
+					if (j->part1->flags & LINKFLAG)
 					{
-						if (!(j->part2->flags&LINKFLAG))
+						if (!(j->part2->flags & LINKFLAG))
 						{
 							change = 1;
@@ -1013,11 +1013,11 @@
 					}
 					else
-						if (j->part2->flags&LINKFLAG)
+						if (j->part2->flags & LINKFLAG)
 						{
-						if (!(j->part1->flags&LINKFLAG))
-						{
-							change = 1;
-							j->part1->flags |= LINKFLAG;
-						}
+							if (!(j->part1->flags & LINKFLAG))
+							{
+								change = 1;
+								j->part1->flags |= LINKFLAG;
+							}
 						}
 				}
@@ -1025,6 +1025,6 @@
 			for (i = 0; i < parts.size(); i++)
 			{
-				p = (Part*)parts(i);
-				if (!(p->flags&LINKFLAG))
+				p = (Part *)parts(i);
+				if (!(p->flags & LINKFLAG))
 				{
 					logPrintf("Model", "internalCheck", LOG_ERROR, "Not all parts connected (eg. Part #0 and Part #%d)%s", i, nameForErrors().c_str());
@@ -1037,5 +1037,5 @@
 		for (i = 0; i < joints.size(); i++)
 		{
-			j = (Joint*)joints(i);
+			j = (Joint *)joints(i);
 			if (j->p1_refno == j->p2_refno)
 			{
@@ -1046,5 +1046,5 @@
 			for (k = i + 1; k < joints.size(); k++)
 			{
-				Joint* j2 = (Joint*)joints(k);
+				Joint *j2 = (Joint *)joints(k);
 				if (((j->p1_refno == j2->p1_refno) && (j->p2_refno == j2->p2_refno))
 					|| ((j->p1_refno == j2->p2_refno) && (j->p2_refno == j2->p1_refno)))
@@ -1073,5 +1073,5 @@
 }
 
-const Geno& Model::getGeno() const
+const Geno &Model::getGeno() const
 {
 	return geno;
@@ -1106,7 +1106,7 @@
 }
 
-Part* Model::getPart(int i) const
-{
-	return ((Part*)parts(i));
+Part *Model::getPart(int i) const
+{
+	return ((Part *)parts(i));
 }
 
@@ -1116,30 +1116,30 @@
 }
 
-Joint* Model::getJoint(int i) const
-{
-	return ((Joint*)joints(i));
-}
-
-int Model::findJoints(SList& result, const Part* part)
+Joint *Model::getJoint(int i) const
+{
+	return ((Joint *)joints(i));
+}
+
+int Model::findJoints(SList &result, const Part *part)
 {
 	Joint *j;
 	int n0 = result.size();
 	if (part)
-		for (int i = 0; j = (Joint*)joints(i); i++)
-			if ((j->part1 == part) || (j->part2 == part)) result += (void*)j;
+		for (int i = 0; j = (Joint *)joints(i); i++)
+			if ((j->part1 == part) || (j->part2 == part)) result += (void *)j;
 	return result.size() - n0;
 }
 
-int Model::findNeuro(Neuro* n)
+int Model::findNeuro(Neuro *n)
 {
 	return neurons.find(n);
 }
 
-int Model::findPart(Part* p)
+int Model::findPart(Part *p)
 {
 	return parts.find(p);
 }
 
-int Model::findJoint(Joint* j)
+int Model::findJoint(Joint *j)
 {
 	return joints.find(j);
@@ -1148,5 +1148,5 @@
 int Model::findJoint(Part *p1, Part *p2)
 {
-	Joint* j;
+	Joint *j;
 	for (int i = 0; j = getJoint(i); i++)
 		if ((j->part1 == p1) && (j->part2 == p2)) return i;
@@ -1161,7 +1161,7 @@
 }
 
-Neuro* Model::getNeuro(int i) const
-{
-	return (Neuro*)neurons(i);
+Neuro *Model::getNeuro(int i) const
+{
+	return (Neuro *)neurons(i);
 }
 
@@ -1174,11 +1174,11 @@
 }
 
-int Model::findNeuros(SList& result,
-	const char* classname, const Part* part, const Joint* joint)
+int Model::findNeuros(SList &result,
+	const char *classname, const Part *part, const Joint *joint)
 {
 	Neuro *nu;
 	SString cn(classname);
 	int n0 = result.size();
-	for (int i = 0; nu = (Neuro*)neurons(i); i++)
+	for (int i = 0; nu = (Neuro *)neurons(i); i++)
 	{
 		if (part)
@@ -1188,5 +1188,5 @@
 		if (classname)
 			if (nu->getClassName() != cn) continue;
-		result += (void*)nu;
+		result += (void *)nu;
 	}
 	return result.size() - n0;
@@ -1202,7 +1202,7 @@
 	{
 		Part *p = getPart(i);
-		p->p.x += (rnd01 - 0.5)*amount;
-		p->p.y += (rnd01 - 0.5)*amount;
-		p->p.z += (rnd01 - 0.5)*amount;
+		p->p.x += (rndDouble(1) - 0.5) * amount;
+		p->p.y += (rndDouble(1) - 0.5) * amount;
+		p->p.z += (rndDouble(1) - 0.5) * amount;
 	}
 	for (i = 0; i < joints.size(); i++)
@@ -1215,13 +1215,13 @@
 }
 
-void Model::move(const Pt3D& shift)
-{
-	FOREACH(Part*, p, parts)
+void Model::move(const Pt3D &shift)
+{
+	FOREACH(Part *, p, parts)
 		p->p += shift;
 }
 
-void Model::rotate(const Orient& rotation)
-{
-	FOREACH(Part*, p, parts)
+void Model::rotate(const Orient &rotation)
+{
+	FOREACH(Part *, p, parts)
 	{
 		p->p = rotation.transform(p->p);
@@ -1230,5 +1230,5 @@
 }
 
-void Model::buildUsingSolidShapeTypes(const Model& src_ballandstick_shapes, Part::Shape use_shape, double thickness)
+void Model::buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape, double thickness)
 {
 	for (int i = 0; i < src_ballandstick_shapes.getJointCount(); i++)
@@ -1247,9 +1247,9 @@
 		for (int i = 0; i < src_ballandstick_shapes.getPartCount(); i++)
 		{
-		Part *op = src_ballandstick_shapes.getPart(i);
-		Part *p = addNewPart(Part::SHAPE_ELLIPSOID); //always using spherical shape regardless of the 'use_shape' parameter - 'use shape' is meant for sticks!
-		p->p = op->p;
-		p->rot = op->rot;
-		p->scale.x = p->scale.y = p->scale.z = thickness;
+			Part *op = src_ballandstick_shapes.getPart(i);
+			Part *p = addNewPart(Part::SHAPE_ELLIPSOID); //always using spherical shape regardless of the 'use_shape' parameter - 'use shape' is meant for sticks!
+			p->p = op->p;
+			p->rot = op->rot;
+			p->scale.x = p->scale.y = p->scale.z = thickness;
 		}
 	for (int i = 0; i < src_ballandstick_shapes.getPartCount(); i++)
@@ -1275,5 +1275,5 @@
 }
 
-SolidsShapeTypeModel::SolidsShapeTypeModel(Model& m, Part::Shape use_shape, double thickness)
+SolidsShapeTypeModel::SolidsShapeTypeModel(Model &m, Part::Shape use_shape, double thickness)
 {
 	using_model = converted_model = NULL;
@@ -1334,11 +1334,11 @@
 class MaxNeuro : public Neuro { public: MaxNeuro() { Param par(f0_neuro_paramtab, this); par.setMax(); } };
 
-Part& Model::getMinPart() { static MinPart part; return part; }
-Part& Model::getMaxPart() { static MaxPart part; return part; }
-Part& Model::getDefPart() { static Part part; return part; }
-Joint& Model::getMinJoint() { static MinJoint joint; return joint; }
-Joint& Model::getMaxJoint() { static MaxJoint joint; return joint; }
-Joint& Model::getDefJoint() { static Joint joint; return joint; }
-Neuro& Model::getMinNeuro() { static MinNeuro neuro; return neuro; }
-Neuro& Model::getMaxNeuro() { static MaxNeuro neuro; return neuro; }
-Neuro& Model::getDefNeuro() { static Neuro neuro; return neuro; }
+Part &Model::getMinPart() { static MinPart part; return part; }
+Part &Model::getMaxPart() { static MaxPart part; return part; }
+Part &Model::getDefPart() { static Part part; return part; }
+Joint &Model::getMinJoint() { static MinJoint joint; return joint; }
+Joint &Model::getMaxJoint() { static MaxJoint joint; return joint; }
+Joint &Model::getDefJoint() { static Joint joint; return joint; }
+Neuro &Model::getMinNeuro() { static MinNeuro neuro; return neuro; }
+Neuro &Model::getMaxNeuro() { static MaxNeuro neuro; return neuro; }
+Neuro &Model::getDefNeuro() { static Neuro neuro; return neuro; }
Index: cpp/frams/model/model.h
===================================================================
--- cpp/frams/model/model.h	(revision 895)
+++ cpp/frams/model/model.h	(revision 896)
@@ -1,4 +1,4 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
@@ -77,5 +77,5 @@
 	SList parts, joints, neurons;
 	char partmappingchanged;
-	vector<Model*> checkpoints;
+	vector<Model *> checkpoints;
 
 	void internalCopy(const Model &mod);
@@ -141,5 +141,5 @@
 
 	int getCheckpointCount();
-	Model* getCheckpoint(int i);
+	Model *getCheckpoint(int i);
 
 	/// The bounding box size. Valid if the model is valid. Read only.
@@ -201,5 +201,5 @@
 
 	/// change source genotype
-	void setGeno(const Geno& newgeno);
+	void setGeno(const Geno &newgeno);
 
 	/** @return f0 genotype - generated from current model state
@@ -241,5 +241,5 @@
 		@see convmap
 		*/
-	void getCurrentToF0Map(MultiMap& m);
+	void getCurrentToF0Map(MultiMap &m);
 
 	void setValidationLevel(int level)
@@ -250,5 +250,5 @@
 	/// calculate location of the new part connected to the existing one
 	/// using delta option
-	Pt3D whereDelta(const Part& start, const Pt3D& rot, const Pt3D& delta);
+	Pt3D whereDelta(const Part &start, const Pt3D &rot, const Pt3D &delta);
 
 	/// create the whole model from scratch, using current genotype
@@ -256,5 +256,5 @@
 
 	/// setGeno(newgeno); rebuild();
-	void rebuild(const Geno& newgeno, bool buildmaps) { setGeno(newgeno); rebuild(buildmaps); }
+	void rebuild(const Geno &newgeno, bool buildmaps) { setGeno(newgeno); rebuild(buildmaps); }
 
 	/// reuse current model object but discard all model data
@@ -262,5 +262,5 @@
 
 	enum ItemType { UnknownType, ModelType, PartType, JointType, NeuronType, NeuronConnectionType, CheckpointType };
-	static ItemType itemTypeFromLinePrefix(const char* line);
+	static ItemType itemTypeFromLinePrefix(const char *line);
 	/** Execute single line of <B>f0</B> genotype.
 		Return value is non-negative reference number of the created item,
@@ -270,9 +270,9 @@
 		@param srcrange source genotype range which will be mapped to this element
 		*/
-	int addFromString(ItemType item_type, const SString &singleline, int line_num, const MultiRange* srcrange = NULL);
+	int addFromString(ItemType item_type, const SString &singleline, int line_num, const MultiRange *srcrange = NULL);
 	/** Execute single line of <B>f0</B> genotype - compatiblity variant */
-	int addFromString(ItemType item_type, const SString &singleline, const MultiRange* srcrange = NULL);
+	int addFromString(ItemType item_type, const SString &singleline, const MultiRange *srcrange = NULL);
 	/** Execute single line of <B>f0</B> genotype - low level variant, used by Model::build(), error messages returned as string instead of calling logger */
-	int addFromStringNoLog(ItemType item_type, const SString &singleline, SString& error_message, const MultiRange* srcrange = 0);
+	int addFromStringNoLog(ItemType item_type, const SString &singleline, SString &error_message, const MultiRange *srcrange = 0);
 
 	/// separate build stages (for future use)
@@ -357,9 +357,9 @@
 
 	/// @return part index or -1 if not found in the model
-	int findPart(Part* p);
+	int findPart(Part *p);
 	/// @return joint index or -1 if not found in the model
-	int findJoint(Joint* j);
+	int findJoint(Joint *j);
 	/// @return neuro index or -1 if not found in the model
-	int findNeuro(Neuro* nu);
+	int findNeuro(Neuro *nu);
 	/// @return joint index or -1 if not found in the model
 	int findJoint(Part *p1, Part *p2);
@@ -368,20 +368,20 @@
 		@param result objects will be appended here
 		@return number of objects found  */
-	int findNeuros(SList& result, const char* classname = 0, const Part* part = 0, const Joint* joint = 0);
+	int findNeuros(SList &result, const char *classname = 0, const Part *part = 0, const Joint *joint = 0);
 
 	/** search for joints connected to the part
 		@param result objects will be appended here
 		@return number of objects found  */
-	int findJoints(SList& result, const Part* part = 0);
+	int findJoints(SList &result, const Part *part = 0);
 
 	void disturb(double amount);
-	void move(const Pt3D& shift);
+	void move(const Pt3D &shift);
 	/// rotate around the origin (move-rotate-move to rotate around arbitrary point)
-	void rotate(const Orient& rotation);
+	void rotate(const Orient &rotation);
 	/// rotate around the origin (move-rotate-move to rotate around arbitrary point)
-	void rotate(const Pt3D& angles) { Orient o = Orient_1; o.rotate(angles); rotate(o); }
+	void rotate(const Pt3D &angles) { Orient o = Orient_1; o.rotate(angles); rotate(o); }
 
 	/// build this model using solid shape types, based on the provided ball-and-stick model. See also shapeconvert.cpp.
-	void buildUsingSolidShapeTypes(const Model& src_ballandstick_shapes, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = 0.2);
+	void buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = 0.2);
 
 protected:
@@ -403,17 +403,17 @@
 	static int mapToNeuro(int i);
 
-	static void makeGenToGenMap(MultiMap& result, const MultiMap& gen1tomodel, const MultiMap& gen2tomodel);
+	static void makeGenToGenMap(MultiMap &result, const MultiMap &gen1tomodel, const MultiMap &gen2tomodel);
 
 	///////////////////////////
 
-	static Part& getMinPart();
-	static Part& getMaxPart();
-	static Part& getDefPart();
-	static Joint& getMinJoint();
-	static Joint& getMaxJoint();
-	static Joint& getDefJoint();
-	static Neuro& getMinNeuro();
-	static Neuro& getMaxNeuro();
-	static Neuro& getDefNeuro();
+	static Part &getMinPart();
+	static Part &getMaxPart();
+	static Part &getDefPart();
+	static Joint &getMinJoint();
+	static Joint &getMaxJoint();
+	static Joint &getDefJoint();
+	static Neuro &getMinNeuro();
+	static Neuro &getMaxNeuro();
+	static Neuro &getDefNeuro();
 };
 
@@ -436,7 +436,7 @@
 	Model *converted_model;
 	Model *using_model;
-	SolidsShapeTypeModel(Model& m, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = 0.2);
-	operator Model&() { return *using_model; }
-	Model& getModel() { return *using_model; }
+	SolidsShapeTypeModel(Model &m, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = 0.2);
+	operator Model &() { return *using_model; }
+	Model &getModel() { return *using_model; }
 	~SolidsShapeTypeModel() { if (converted_model) delete converted_model; }
 };
Index: cpp/frams/neuro/impl/neuroimpl-simple.h
===================================================================
--- cpp/frams/neuro/impl/neuroimpl-simple.h	(revision 895)
+++ cpp/frams/neuro/impl/neuroimpl-simple.h	(revision 896)
@@ -77,5 +77,5 @@
 public:
 	NeuroImpl* makeNew() { return new NI_Random(); };
-	void go() { setState(rnd01*2.0 - 1.0); }
+	void go() { setState(rndDouble(2) - 1.0); }
 };
 
Index: cpp/frams/neuro/neuroimpl.cpp
===================================================================
--- cpp/frams/neuro/neuroimpl.cpp	(revision 895)
+++ cpp/frams/neuro/neuroimpl.cpp	(revision 896)
@@ -85,5 +85,5 @@
 	for (i = 0; n = mod.getNeuro(i); i++)
 	{
-		n->state += (rnd01 - 0.5)*config.randominit;
+		n->state += (rndDouble(1) - 0.5)*config.randominit;
 		ni = (NeuroImpl*)n->userdata[mytags_id];
 		if (!ni) continue;
Index: cpp/frams/util/rndutil.cpp
===================================================================
--- cpp/frams/util/rndutil.cpp	(revision 895)
+++ cpp/frams/util/rndutil.cpp	(revision 896)
@@ -21,11 +21,11 @@
 double CustomRnd(double *tab)
 {
-	double *range = tab + 1 + 2 * randomN((int)(0.5 + tab[0]));
-	return range[0] + rnd0N(range[1] - range[0]);
+	double *range = tab + 1 + 2 * rndUint((int)(0.5 + tab[0]));
+	return range[0] + rndDouble(range[1] - range[0]);
 }
 
 double RandomGener::Uni(double begin, double end)
 {
-	return begin + rnd01*(end - begin);
+	return begin + rndDouble(end - begin);
 }
 
@@ -35,6 +35,6 @@
 	double v1, v2, s;
 	do {
-		v1 = 2 * rnd01 - 1; //-1..1
-		v2 = 2 * rnd01 - 1; //-1..1
+		v1 = rndDouble(2) - 1; //-1..1
+		v2 = rndDouble(2) - 1; //-1..1
 		s = v1*v1 + v2*v2;
 	} while (s >= 1);
