Hello,
Is there a function in UltraEdit to mix lines of text in a random order? By a line of text I mean a text string that ends with a line break.
Welcome to the IDM Forum. This forum is meant as a user-to-user support mechanism where users can share knowledge and tips for all IDM software.
Since these forums are user-to-user based, IDM does not regularly read or reply to the posts in this forum. For problem reports, suggestions, or feature requests, you must email us directly. Our trained technical support staff answers most inquiries within 30 minutes.

mjcarman wrote:A better solution would be to write a script to shuffle lines based on the results of a rand() call.

/* Fisher-Yates shuffle of file */
var i, j; // line numbers
var a, b; // line text
UltraEdit.activeDocument.bottom();
i = UltraEdit.activeDocument.currentLineNum;
while (--i) {
j = rand(i + 1);
UltraEdit.activeDocument.gotoLine(i, 0);
UltraEdit.activeDocument.selectLine();
a = UltraEdit.activeDocument.selection;
UltraEdit.activeDocument.gotoLine(j, 0);
UltraEdit.activeDocument.selectLine();
b = UltraEdit.activeDocument.selection;
UltraEdit.activeDocument.deleteLine();
UltraEdit.activeDocument.write(a);
UltraEdit.activeDocument.gotoLine(i, 0);
UltraEdit.activeDocument.deleteLine();
UltraEdit.activeDocument.write(b);
}
// Generate a random integer in the range [0, N)
function rand(n) {
return Math.floor(Math.random() * n);
}