随机播放答案属性

编程入门 行业动态 更新时间:2024-10-28 10:27:25
本文介绍了随机播放答案属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我必须激活属性才能改变多选类型questoin的问题,但找不到属性.我发现这段代码随机分配了问题,但没有给出答案.

I have to activate the properties to shuffle the question of a multiple choice type questoin, but I can't find the properties. I found this code that randomizes questions, but not the answers.

form.setShuffleQuestions(true);

视觉组件的图像

推荐答案

问题跟踪程序:

目前无法实现.考虑在以下功能请求中添加一个星号(在左上方),以供Google优先考虑该问题:

Issuetracker:

This isn't currently possible. Consider adding a star (on top left) to the following feature requests for Google to prioritize the issue:

  • issuetracker.google/issues/36764938

issuetracker.google/issues/64134484

在此答案中已经提到的 的部分解决方法是改组数组创建选项并使用 setChoiceValues().这种服务器端随机化的缺点是

Partial Workaround as already mentioned in this answer is to shuffle the array creating options and setback the array using setChoiceValues(). The drawback of such server side randomizing is

  • 只能在运行服务器脚本时执行,而不能在客户端打开表单时执行

  • It can only be done whenever the server script runs and not when client opens the form

即使您每分钟随机进行一次,也可能同时打开表格的用户会看到相同顺序的选项

Even if you randomize each minute, it is possible that users opening the form simultaneously will see the same order of options

const form = FormApp.openById('/*form id*/'); const item = form.addMultipleChoiceItem(); item.setTitle('Car or truck?'); const options = ['Truck', 'Car']; //Durstenfeld algo for (let i = options.length - 1; i > 0; i--) { let rand = Math.floor(Math.random() * i); [options[i], options[rand]] = [options[rand], options[i]]; } item.setChoiceValues(options);

更多推荐

随机播放答案属性

本文发布于:2023-10-28 08:12:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1536050.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   答案

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!