随即约束唯一标识unique

unique可以用来约束一组变量,使随机后的变量之间不会有相同的数值;

rand int x[8];

rand int y;

rand int z;

constraint c0 {unique {x[1:5], y, z};}

x[1],x[2],..x[5],y,z之间不会随机出相同的值;

如果想让x数组随机出不同的值,可以用:

constraint c1{unique {x};}

posted on 2025-08-22 15:38  lybinger  阅读(6)  评论(0)    收藏  举报

导航