jsPsych/tests&examples/randomization-module.html
2016-01-05 10:47:53 -05:00

31 lines
773 B
HTML

<!doctype html>
<html>
<head>
<script src="js/jquery.min.js"></script>
<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));
</script>
</html>