在c#中如何得到一个随机的布尔值?

2025-04-03 16:46:29
推荐回答(1个)
回答1:

bool b = false;
Random rd = new Random();
int x = rd.Next();
b = (x % 2 == 0);