title: How to distribute agents' attributes randomly according to specific probabilities in Netlogo?
body: <p>I am relatively new to Netlogo, having completed only a handful of models. Currently working on one for my dissertation where I need to distribute agents' attributes randomly according to specific probabilities, some at the onset of the simulation, other attributes to be distributed throughout. This is connected with an extension of the trust game, for those familiar with it. I completed the conceptual model with a colleague who doesn't use Netlogo, so I am a bit stuck at the moment.</p>
  
  <p>I think the rnd extension might be useful, but I can't quite figure out how to use it. My apologies if this seems redundant to any of you, but I really hope to get some help here. </p>
  
  <pre><code>extensions [ rnd]
  
  ;; divides agents into two types
  breed [ sexworkers sexworker ]
  breed [ officers officer ]
  
  ;; determines attributes of agents
  sexworkers-own
  [ assault?       ;; is assaulted
    trust?         ;; probability to trust police to report assault
    protection?    ;; probability of good experience with police during report
    prob-trust ]   ;; probability to trust overall
  
  officers-own
  [ behavior   ] ;; probability of treating sex workers well/badly during report
  </code></pre>
  
  <p>This is the start of the model, and then I want to distribute the attributes according to specific probabilities. I honestly haven't found a way to do this that works as I intend it to. 
  What  I want is to start off, for every sex worker alike, a probability of 0.01 to be assaulted (prob-assault; assault?=true). Afterwards, with each tick, there is again the chance of 0.01 for sex workers to be assaulted. </p>
  
  <p>Afterwards, in the subset of assault?=true, there is then a probability to report the assault (prob-report, 0.5. This is expressed by trust?=true/false. Within the subset of those who report, there is then a final probability of having a good/bad experience with police (prob-protection), here protection?=true/false. </p>
  
  <p>These three attributes should be randomly distributed according to the probabilities, and also then result in a combined probability to trust police in the future, prob-trust. (prob-trust = prob-assault + prob-report + prob-protection).</p>
  
  <p>What I have done (without rnd extension so far is this:</p>
  
  <pre><code>      ;; determines sex workers' behavior
        ask sexworkers [ move ]
        ask sexworkers [ victimize ]
        ask sexworkers [ file ]
  
      to victimize
   ask sexworkers [
      ifelse random-float 1 &lt;= 0.0001 
      [ set assault? 1 ]
      [ set assault? 0 ]
    ]
  end
  
  to file 
    ask sexworkers with [ assault? = 1 ] [
     ifelse random-float 1 &lt;= 0.5 
      [ cooperate ]
      [ avoid ] 
    ]
  end
  
  to cooperate
    ask sexworkers [ set trust? 1  ]
  end
  
  to avoid
    ask sexworkers [ set trust? 0 ]
  end
  </code></pre>
  
  <p>What happens at the moment though is that there is no variation in attributes, all sex workers seem to have no assault and trust/not trust varying all simultaneously. I am not sure what is going on. </p>