mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
Changed the way the random indices are chosen
Only the offset is random. The indices are then spaced evenly.
This commit is contained in:
parent
b4a8507140
commit
22fda1eac7
@ -65,16 +65,21 @@
|
||||
}
|
||||
|
||||
function forEachIndex(array, prefs, callback){
|
||||
var l = array.length;
|
||||
var length = array.length;
|
||||
var rate = getAudioFakeRate(array, prefs);
|
||||
var indexRng = randomSupply.getIndexRng(rate, l, window);
|
||||
var start = 0;
|
||||
forEachFixedIndex(prefs, function(index){
|
||||
callback(index, start);
|
||||
start += 1;
|
||||
});
|
||||
for (var i = start; i < rate; i += 1){
|
||||
callback(indexRng(i), i);
|
||||
if (start < rate){
|
||||
var delta = Math.floor(length / (rate - start));
|
||||
var indexRng = randomSupply.getIndexRng(1, length - delta * (rate - start - 1), window);
|
||||
var offset = indexRng(0);
|
||||
for (var i = start; i < rate; i += 1){
|
||||
callback(offset, i);
|
||||
offset += delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@
|
||||
},
|
||||
{
|
||||
name: "audioFakeRate",
|
||||
defaultValue: "10",
|
||||
defaultValue: "100",
|
||||
options: ["1", "10", "100", "1000", "0.1%", "1%"]
|
||||
},
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user