[{"data":1,"prerenderedAt":268},["ShallowReactive",2],{"/rnd/weighted-n-of-list":3,"/rnd/weighted-n-of-list-surround":257},{"id":4,"title":5,"body":6,"description":224,"extension":225,"meta":226,"navigation":243,"path":253,"seo":254,"stem":255,"__hash__":256},"content/rnd/weighted-n-of-list.md","Rnd Extension Dictionary: weighted-n-of-list",{"type":7,"value":8,"toc":213},"minimark",[9],[10,11,15,16,15,26,54,58,62,63,68,69,72,76,77,83,84,87,91,92,97,98,106,117,120,210],"div",{"className":12,"id":14},[13],"dict_entry","weighted-n-of-list","\n  ",[17,18,20,21,15],"h3",{"id":19},"rndweighted-n-of-list","\n    ",[22,23,25],"a",{"href":24},"#weighted-n-of-list","rnd:weighted-n-of-list",[27,28,32],"h4",{"id":29,"className":30},"rndweighted-n-of-list-size-netlogo-list-anonymous-reporter",[31],"section-heading",[22,33,20,37,15],{"className":34,"href":36},[35],"section-anchor","#----rndweighted-n-of-list-size-netlogo-list-anonymous-reporter--",[38,39,42,43,47,48,47,51],"span",{"className":40},[41],"prim_example","rnd:weighted-n-of-list ",[44,45,46],"i",{},"size"," ",[44,49,50],{},"netlogo-list",[44,52,53],{},"anonymous-reporter",[55,56,57],"p",{},"Reports a list of the given ",[10,59,60],{},[44,61,46],{}," randomly chosen from the ",[10,64,65],{},[44,66,67],{},"list"," of candidates, with no repeats.",[55,70,71],{},"The probability of each item being picked is proportional to the weight given by the ",[10,73,74],{},[44,75,53],{}," for that item. The weights must not be negative. The first argument passed to the anonymous procedure refers to the list item. (See the ",[22,78,82],{"href":79,"rel":80},"https://ccl.northwestern.edu/netlogo/docs/programming.html#anonymous-procedures",[81],"nofollow","Anonymous Procedures section"," of the Programming Guide for more details.)",[55,85,86],{},"It is an error for ",[10,88,89],{},[44,90,46],{}," to be greater than the size of the ",[10,93,94,96],{},[44,95,67],{}," of candidates",".",[55,99,100,101,105],{},"If, at some point during the selection, there remains only candidates with a weight of ",[102,103,104],"code",{},"0.0",", they all have an equal probability of getting picked.",[55,107,108,109,116],{},"The items in the resulting list appear in the same order that they appeared in the list of candidates. (If you want them in random order, use ",[22,110,113],{"href":111,"rel":112},"http://ccl.northwestern.edu/netlogo/docs/dictionary.html#shuffle",[81],[102,114,115],{},"shuffle"," on the result).",[55,118,119],{},"Example:",[121,122,123],"pre",{},[102,124,125,47,131,47,136,47,141,146,147,151,152,47,156,47,160,164,165,47,168,47,172,176,177,182,185,47,189,47,192,47,196,146,199,151,203,47,206,209],{},[38,126,130],{"className":127},[128,129],"token","command","let",[38,132,135],{"className":133},[128,134],"variable","candidates",[38,137,140],{"className":138},[128,139],"reporter","n-values",[38,142,145],{"className":143},[128,144],"number","8"," [ [",[38,148,150],{"className":149},[128,134],"n","] ",[38,153,155],{"className":154},[128,139],"->",[38,157,159],{"className":158},[128,144],"2",[38,161,163],{"className":162},[128,139],"^"," (",[38,166,150],{"className":167},[128,134],[38,169,171],{"className":170},[128,139],"+",[38,173,175],{"className":174},[128,144],"1",") ] ",[38,178,181],{"className":179},[128,180],"comment","; make a list with the powers of two",[183,184],"br",{},[38,186,188],{"className":187},[128,129],"print",[38,190,25],{"className":191},[128,134],[38,193,195],{"className":194},[128,144],"4",[38,197,135],{"className":198},[128,134],[38,200,202],{"className":201},[128,134],"w",[38,204,155],{"className":205},[128,139],[38,207,202],{"className":208},[128,134]," ]",[55,211,212],{},"This should print a list of four numbers, where the bigger numbers (32, 64, 128, 256) have a much better chance to show up than the smaller ones (2, 4, 8, 16).",{"title":214,"searchDepth":215,"depth":216,"links":217},"",5,3,[218],{"id":19,"depth":216,"text":219,"children":220},"\n    rnd:weighted-n-of-list\n  ",[221],{"id":29,"depth":222,"text":223},4,"\n    rnd:weighted-n-of-list size netlogo-list anonymous-reporter\n  ","Documentation for the weighted-n-of-list primitive.","md",{"source":227,"metadataOutputPath":228,"projectConfig":229,"language":236,"inheritFrom":244,"output":243,"version":230,"layout":245,"dictionaryDisplayName":246,"dictionaryHomeDirectory":247,"indexFileURI":248,"currentItemId":14,"currentItemLabel":25,"primRoot":249,"icon":250,"extensionName":251,"assetsRoot":231},"../../external/extensions/rnd/rnd/weighted-n-of-list.md","content/rnd/weighted-n-of-list.metadata.yaml",{"version":230,"projectRoot":97,"scanRoot":231,"outputRoot":232,"defaults":233,"engine":239,"partials":240,"dedupeIdenticalDiskWrites":243},"7.0.4","/home/runner/work/Helio/Helio/external/extensions/rnd","content",{"inheritFrom":234,"language":236,"output":237,"extension":225,"title":238,"version":230},[235],0,"en",false,"NetLogo User Manual","mustache",{"directoryPaths":241,"extensions":242},[97],[239,225],true,[235],"catalog","Rnd Extension Dictionary","/rnd.html","/_index/extensions/rnd.txt","rnd","i-mingcute-random-line",{"shortName":249,"fullName":252},"Rnd","/rnd/weighted-n-of-list",{"title":5,"description":224},"rnd/weighted-n-of-list","2bmoTAznWJjsctMuII79j7D32R0LiQFE-vd0GlrxrIU",[258,263],{"title":259,"path":260,"stem":261,"description":262},"Rnd Extension Dictionary: weighted-n-of","/rnd/weighted-n-of","rnd/weighted-n-of","Documentation for the weighted-n-of primitive.",{"title":264,"path":265,"stem":266,"description":267},"Rnd Extension Dictionary: weighted-n-of-list-with-repeats","/rnd/weighted-n-of-list-with-repeats","rnd/weighted-n-of-list-with-repeats","Documentation for the weighted-n-of-list-with-repeats primitive.",1777657898337]