Index: src/globals.h
===================================================================
--- src/globals.h	(revision 4ccf855df8403d6d7f1afaa2145a9f83016b3e3d)
+++ src/globals.h	(revision f1fb54b9f7060896ae686783ee1d8dcdce8d9409)
@@ -46,4 +46,6 @@
 //! Default number of cities
 #define DEF_NUM_CITIES 5
+//! Default value for generating fractional random values
+#define DEF_FRACTIONAL_RANDOM false
 //! Default value for showing or not solution step matrices
 #define DEF_SHOW_MATRIX true
@@ -52,4 +54,6 @@
 //! Default maximum number of cities to show solution step matrices
 #define DEF_SHOW_MATRIX_CITY_LIMIT 15
+//! Default for scrolling to the end of output after solving
+#define DEF_SCROLL_TO_END true
 //! Default font name
 #define DEF_FONT_FAMILY "Courier New"
@@ -108,4 +112,16 @@
 #define INFSTR "---"
 
+// FUNCTIONS
+/*!
+ * \brief Checks whether \a x contains an integer value
+ * \param x A value to check
+ * \return \c true if \a x countains an integer, oherwise \c false
+ */
+inline bool isInteger(double x)
+{
+double i;
+	return (modf(x, &i) == 0.0);
+}
+
 // Sanity checks
 // Check that default number of cities is sane (<= MAX_NUM_CITIES)
Index: src/mainwindow.cpp
===================================================================
--- src/mainwindow.cpp	(revision 4ccf855df8403d6d7f1afaa2145a9f83016b3e3d)
+++ src/mainwindow.cpp	(revision f1fb54b9f7060896ae686783ee1d8dcdce8d9409)
@@ -450,5 +450,8 @@
 		output.append("<p>" + trUtf8("Resulting path:") + "</p>");
 	output.append("<p>&nbsp;&nbsp;" + solver.getSortedPath() + "</p>");
-	output.append("<p>" + trUtf8("The price is <b>%n</b> unit(s).", "", step->price) + "</p>");
+	if (isInteger(step->price))
+		output.append("<p>" + trUtf8("The price is <b>%n</b> unit(s).", "", step->price) + "</p>");
+	else
+		output.append("<p>" + trUtf8("The price is <b>%1</b> units.").arg(step->price, 0, 'f', 2) + "</p>");
 	if (!solver.isOptimal()) {
 		output.append("<p>&nbsp;</p>");
@@ -460,6 +463,8 @@
 	solutionText->setDocumentTitle(trUtf8("Solution of Variant #%1 task").arg(spinVariant->value()));
 
-	// Scrolling to the end of text.
-	solutionText->moveCursor(QTextCursor::End);
+	if (settings->value("Output/ScrollToEnd", DEF_SCROLL_TO_END).toBool()) {
+		// Scrolling to the end of text.
+		solutionText->moveCursor(QTextCursor::End);
+	}
 
 	toggleSolutionActions();
@@ -655,5 +660,5 @@
 				line += "<td align=\"center\">"INFSTR"</td>";
 			else
-				line += "<td align=\"center\">" + QVariant(matrix.at(r).at(c)).toString() + "</td>";
+				line += isInteger(matrix.at(r).at(c)) ? QString("<td align=\"center\">%1</td>").arg(matrix.at(r).at(c)) : QString("<td align=\"center\">%1</td>").arg(matrix.at(r).at(c), 0, 'f', 2);
 		}
 		line += "</tr>";
@@ -674,5 +679,5 @@
 				line += "<td align=\"center\">"INFSTR"</td>";
 			else if ((r == step.candidate.nRow) && (c == step.candidate.nCol))
-				line += "<td align=\"center\" class=\"selected\">" + QVariant(step.matrix.at(r).at(c)).toString() + "</td>";
+				line += isInteger(step.matrix.at(r).at(c)) ? QString("<td align=\"center\" class=\"selected\">%1</td>").arg(step.matrix.at(r).at(c)) : QString("<td align=\"center\" class=\"selected\">%1</td>").arg(step.matrix.at(r).at(c), 0, 'f', 2);
 			else {
 SCandidate cand;
@@ -680,7 +685,7 @@
 				cand.nCol = c;
 				if (step.alts.contains(cand))
-					line += "<td align=\"center\" class=\"alternate\">" + QVariant(step.matrix.at(r).at(c)).toString() + "</td>";
+					line += isInteger(step.matrix.at(r).at(c)) ? QString("<td align=\"center\" class=\"alternate\">%1</td>").arg(step.matrix.at(r).at(c)) : QString("<td align=\"center\" class=\"alternate\">%1</td>").arg(step.matrix.at(r).at(c), 0, 'f', 2);
 				else
-					line += "<td align=\"center\">" + QVariant(step.matrix.at(r).at(c)).toString() + "</td>";
+					line += isInteger(step.matrix.at(r).at(c)) ? QString("<td align=\"center\">%1</td>").arg(step.matrix.at(r).at(c)) : QString("<td align=\"center\">%1</td>").arg(step.matrix.at(r).at(c), 0, 'f', 2);
 			}
 		}
Index: src/settingsdialog.cpp
===================================================================
--- src/settingsdialog.cpp	(revision 4ccf855df8403d6d7f1afaa2145a9f83016b3e3d)
+++ src/settingsdialog.cpp	(revision f1fb54b9f7060896ae686783ee1d8dcdce8d9409)
@@ -63,6 +63,8 @@
 	vbox2->addWidget(groupOutputSettings);
 	vbox2->addStretch();
+	vbox2->addWidget(cbFractionalRandom);
 	vbox2->addWidget(cbShowMatrix);
 	vbox2->addLayout(layoutCitiesLimit);
+	vbox2->addWidget(cbScrollToEnd);
 	vbox2->addWidget(cbAutosize);
 
@@ -150,6 +152,8 @@
 	vbox2->addStretch();
 	vbox2->addLayout(hbox2);
+	vbox2->addWidget(cbFractionalRandom);
 	vbox2->addWidget(cbShowMatrix);
 	vbox2->addLayout(layoutCitiesLimit);
+	vbox2->addWidget(cbScrollToEnd);
 	vbox2->addWidget(cbAutosize);
 	vbox2->addWidget(cbSaveState);
@@ -188,4 +192,5 @@
 	spinRandMax->setMaximum(MAX_RAND_VALUE);
 	spinRandMax->setValue(settings->value("MaxCost",DEF_RAND_MAX).toInt());
+	cbFractionalRandom->setChecked(settings->value("FractionalRandom", DEF_FRACTIONAL_RANDOM).toBool());
 	cbAutosize->setChecked(settings->value("Autosize",true).toBool());
 #ifndef Q_OS_WINCE
@@ -200,4 +205,5 @@
 	spinCitiesLimit->setValue(settings->value("ShowMatrixCitiesLimit", DEF_SHOW_MATRIX_CITY_LIMIT).toInt());
 	spinCitiesLimit->setMaximum(MAX_NUM_CITIES);
+	cbScrollToEnd->setChecked(settings->value("ScrollToEnd", DEF_SCROLL_TO_END).toBool());
 
 	font = settings->value("Font",QFont(DEF_FONT_FAMILY,DEF_FONT_SIZE)).value<QFont>();
@@ -236,4 +242,5 @@
 	settings->setValue("MinCost", spinRandMin->value());
 	settings->setValue("MaxCost", spinRandMax->value());
+	settings->setValue("FractionalRandom", cbFractionalRandom->isChecked());
 
 	settings->beginGroup("Output");
@@ -242,4 +249,5 @@
 	if (cbCitiesLimit->isChecked())
 		settings->setValue("ShowMatrixCitiesLimit", spinCitiesLimit->value());
+	settings->setValue("ScrollToEnd", cbScrollToEnd->isChecked());
 	if (newFont)
 		settings->setValue("Font", font);
Index: src/tspmodel.cpp
===================================================================
--- src/tspmodel.cpp	(revision 4ccf855df8403d6d7f1afaa2145a9f83016b3e3d)
+++ src/tspmodel.cpp	(revision f1fb54b9f7060896ae686783ee1d8dcdce8d9409)
@@ -466,6 +466,11 @@
 }
 
-inline int CTSPModel::rand(int min, int max) const
-{
-	return min + (int)floor(((double)qrand() / RAND_MAX) * (max + 1 - min));
-}
+inline double CTSPModel::rand(int min, int max) const
+{
+double r;
+	if (settings->value("FractionalRandom", DEF_FRACTIONAL_RANDOM).toBool())
+		r = (double)qRound((double)qrand() / RAND_MAX * (max - min) * 100) / 100;
+	else
+		r = qRound((double)qrand() / RAND_MAX * (max - min));
+	return min + r;
+}
Index: src/tspmodel.h
===================================================================
--- src/tspmodel.h	(revision 4ccf855df8403d6d7f1afaa2145a9f83016b3e3d)
+++ src/tspmodel.h	(revision f1fb54b9f7060896ae686783ee1d8dcdce8d9409)
@@ -69,5 +69,5 @@
 	bool loadTSPT(QDataStream *);
 	bool loadZKT(QDataStream *);
-	int rand(int, int) const;
+	double rand(int, int) const;
 };
 
