小编not*_*ihs的帖子

Cypress - find() 和 inside() 方法之间的区别

使用这两种方法之间有什么区别:


cy.get('.wtv').find('.sub-wtv');

cy.get('.wtv').within(() => {cy.get('.sub-wtv');});

来自文档
https://docs.cypress.io/api/commands/find.html
https://docs.cypress.io/api/commands/within.html

它们都让我们可以使用“子 DOM”,在其中我们可以做任何我们想做的事情,比如搜索特定元素并断言它。

javascript cypress

8
推荐指数
2
解决办法
5470
查看次数

如何使用C从列表中选择一个随机数,仅一次

所以我有一个从0到27的整数数组.

for(i<0; i<28; i++)
{
    ListId[i] = i;
}
Run Code Online (Sandbox Code Playgroud)

我想要做的是从该数组中选择一个数字并随机地在另一个数组中重新排序.

我试图通过一个标志,数字-1替换已经选择的数字:

for(i<0; i<28; i++)
{
    RandomId[i] = i;
    ListId[i] = i;
}

srand(time(NULL));

for(i=0; i<28; i++)
{
    res = rand() % 27;
    aux = ListId[res];

    if (ListId[res] != -1)
    {
        RandomId[i] = aux;
        ListId[res] = -1;
    }
    else
        i--;
}

printf("New list of integers: ");

for(i=0; i<28; i++)
{
    printf("%d | ", RandomId[i]);
}
Run Code Online (Sandbox Code Playgroud)

但最终变成了无限循环.

希望可以有人帮帮我.

先感谢您

c arrays random srand

1
推荐指数
1
解决办法
782
查看次数

标签 统计

arrays ×1

c ×1

cypress ×1

javascript ×1

random ×1

srand ×1