mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
38 lines
960 B
HTML
38 lines
960 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
|
|
<script src="../jspsych.js"></script>
|
|
<link rel="stylesheet" href="../css/jspsych.css"></link>
|
|
<style>
|
|
img { width: 300px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="jspsych-target"></div>
|
|
</body>
|
|
<script>
|
|
|
|
var repeated_list = jsPsych.randomization.repeat([1,2,3,4,5],3);
|
|
console.log(JSON.stringify(repeated_list));
|
|
|
|
var unpack_repeat = [
|
|
{item: 'a', value: 1},
|
|
{item: 'b', value: 2},
|
|
{item: 'c', value: 3}
|
|
];
|
|
console.log(JSON.stringify(jsPsych.randomization.repeat(unpack_repeat,2,true)));
|
|
|
|
var no_neighbor_repeats = jsPsych.randomization.shuffleNoRepeats(repeated_list);
|
|
console.log(JSON.stringify(no_neighbor_repeats));
|
|
|
|
// check to make sure everything is deep copy
|
|
var arr = [];
|
|
for(i=0;i<5;i++){arr.push({i:i})};
|
|
var arr = jsPsych.randomization.repeat(arr,4);
|
|
for(j=0;j<arr.length;j++){arr[j].j=j};
|
|
console.log(JSON.stringify(arr))
|
|
|
|
</script>
|
|
</html>
|