Generate matrix with certain conditions?

I want to generate a n×n matrix.

  1. I want the diagonal entries to be all 0
  2. I want a random choice of matrix elements with 0 or 1.
    The probability of having a 1 as a matrix element is 1/m1/m and the probability of having a 0 as a matrix element is 1?1/m1?1/m.

How to generate a command like this?
Thank you!

Same question posted here with a different user name.

What do you mean by 1?1/m1?1/m ?
Even if interpreted as (1?1/m)(1?1/m) your probabilities don’t add up to 1. Is this your intention?

If you chose n^2/m^2 ones and and put them into your matrix at randomly chosen off-diagonal positions the probability of finding a one should be 1/m^2.
In this case you should arrive at n^2 - n^2/m^2 zeros, the probability of which is then 1 - 1/m^2.

Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST

Please next time link your post to the duplicated one from MSE site.