How to create a random binary array with b bits?

I imagine these are the AVX-512 instructions (using write masks)?
Interesting that it is only using ymm registers.