抱歉,我的问题不太清楚。
我正在遍历数字(function sendtest(e) {
var ss = e.source;
var s = ss.getSheetByName("Test");
var r = e.range;
// Below is the line that selects what column to use for the send date
var actionCol = 2;
var colIndex = r.getColumnIndex();
// Testing if statement
if (e.value == s.getRange(2, 3).getValue () && colIndex == actionCol) {
// All rows below are used to send the email
var row = r.getRowIndex();
// This takes the email addresses in column D
var userEmail = s.getRange(row, 4).getValue ();
//The subject line of the email
var subject = "Test test " + s.getRange(row, 1).getValue ();
//The structure of the body of the email
var body = "It has been two weeks since test test, " + s.getRange(row, 1).getValue ();
body +="\n\ntest test?";
body +="\n\ntest test,";
body +="\n\ntest test";
// This line sends the email
MailApp.sendEmail(userEmail,subject,body);
}
}
),结果应该像这样:
[1...50]
答案 0 :(得分:2)
简单代码是
let number = Int.random(in: 1...5)
print(number)
或
let number = Int.random(in: 1...100)
print(number % 5 + 1)
要在编辑问题后获得所需的结果,请使用
(number - 1) % 5 + 1
如约翰·蒙哥马利(John Montgomery)在评论中所建议。