28 lines
421 B
Text
28 lines
421 B
Text
import system'routines;
|
|
import extensions;
|
|
|
|
const int MAX = 10;
|
|
|
|
extension randomOp
|
|
{
|
|
randomize()
|
|
{
|
|
var max := self.Length;
|
|
|
|
for(int i := 0, i < max, i += 1)
|
|
{
|
|
var j := randomGenerator.eval(i,max);
|
|
|
|
self.exchange(i,j)
|
|
};
|
|
|
|
^ self
|
|
}
|
|
}
|
|
|
|
public program()
|
|
{
|
|
var a := Array.allocate:MAX.populate:(i => i );
|
|
|
|
console.printLine(a.randomize())
|
|
}
|