Re: Zufälliger Zufall
Wenn ich das richtig verstanden habe, sollte das folgende Skript es es tun. Wenn du das Skript 4 mal pro Stunde einplanst und die Wahrscheinlickeit (probability) auf 3% einstellst, dann wird durchschittlich 3 mal am Tag ein Werk der Dire Straits ertönen. // Save as RandomRotation~0.js and schedule every 15 minutes // probability in percent var probability = 3.0; // path to rotation file (replace \ by \\) var rotation = "S:\\My Music\\Dire Straits.rotation";
/************************************************************************/ var random = 100.0 * Math.random(); Application.Console.WriteLine( "random value=" + random ); if( random < probability ) { var date = new Date(); Application.Console.WriteLine( date.toLocaleString() + " rotation: " + rotation ); var selIndex = Application.Playlist.SelectedIndex; Application.Playlist.Insert( 1+selIndex, rotation ); }
|