[{"data":1,"prerenderedAt":283},["ShallowReactive",2],{"/rnd/weighted-n-of-list-with-repeats":3,"/rnd/weighted-n-of-list-with-repeats-surround":272},{"id":4,"title":5,"body":6,"description":238,"extension":239,"meta":240,"navigation":258,"path":268,"seo":269,"stem":270,"__hash__":271},"content/rnd/weighted-n-of-list-with-repeats.md","Rnd Extension Dictionary: weighted-n-of-list-with-repeats",{"type":7,"value":8,"toc":227},"minimark",[9],[10,11,15,16,15,26,54,58,62,63,68,69,72,76,77,83,84,92,96,97,101,102,110,116,127,130,210],"div",{"className":12,"id":14},[13],"dict_entry","weighted-n-of-list-with-repeats","\n  ",[17,18,20,21,15],"h3",{"id":19},"rndweighted-n-of-list-with-repeats","\n    ",[22,23,25],"a",{"href":24},"#weighted-n-of-list-with-repeats","rnd:weighted-n-of-list-with-repeats",[27,28,32],"h4",{"id":29,"className":30},"rndweighted-n-of-list-with-repeats-size-netlogo-list-anonymous-reporter",[31],"section-heading",[22,33,20,37,15],{"className":34,"href":36},[35],"section-anchor","#----rndweighted-n-of-list-with-repeats-size-netlogo-list-anonymous-reporter--",[38,39,42,43,47,48,47,51],"span",{"className":40},[41],"prim_example","rnd:weighted-n-of-list-with-repeats ",[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 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,87,91],{},"It is ",[88,89,90],"strong",{},"not"," an error for ",[10,93,94],{},[44,95,46],{}," to be greater than the size of the ",[10,98,99],{},[44,100,67],{}," of candidates, but there has to be at least one candidate.",[55,103,104,105,109],{},"If, at some point during the selection, there remains only candidates with a weight of ",[106,107,108],"code",{},"0.0",", they all have an equal probability of getting picked.",[55,111,112,113,115],{},"If all weights are ",[106,114,108],{},", each candidate has an equal probability of being picked.",[55,117,118,119,126],{},"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,120,123],{"href":121,"rel":122},"http://ccl.northwestern.edu/netlogo/docs/dictionary.html#shuffle",[81],[106,124,125],{},"shuffle"," on the result).",[55,128,129],{},"Example:",[131,132,133],"pre",{},[106,134,135,47,141,146,147,47,152,157,158,47,162,166,167,170,47,174,47,179,47,183,47,186,47,190,193,194,197,198,47,202,47,206,209],{},[38,136,140],{"className":137},[138,139],"token","command","let",[38,142,145],{"className":143},[138,144],"variable","pairs"," [ [ ",[38,148,151],{"className":149},[138,150],"string","\"A\"",[38,153,156],{"className":154},[138,155],"number","0.2"," ] [ ",[38,159,161],{"className":160},[138,150],"\"B\"",[38,163,165],{"className":164},[138,155],"0.8"," ] ]",[168,169],"br",{},[38,171,173],{"className":172},[138,139],"print",[38,175,178],{"className":176},[138,177],"reporter","map",[38,180,182],{"className":181},[138,177],"first",[38,184,25],{"className":185},[138,144],[38,187,189],{"className":188},[138,155],"25",[38,191,145],{"className":192},[138,144]," [ [",[38,195,55],{"className":196},[138,144],"] ",[38,199,201],{"className":200},[138,177],"->",[38,203,205],{"className":204},[138,177],"last",[38,207,55],{"className":208},[138,144]," ]",[55,211,212,213,216,217,220,221,223,224,226],{},"This should print a list of 25 ",[106,214,215],{},"A","s and ",[106,218,219],{},"B","s, with roughly four times as many ",[106,222,219],{},"s than ",[106,225,215],{},"s.",{"title":228,"searchDepth":229,"depth":230,"links":231},"",5,3,[232],{"id":19,"depth":230,"text":233,"children":234},"\n    rnd:weighted-n-of-list-with-repeats\n  ",[235],{"id":29,"depth":236,"text":237},4,"\n    rnd:weighted-n-of-list-with-repeats size netlogo-list anonymous-reporter\n  ","Documentation for the weighted-n-of-list-with-repeats primitive.","md",{"source":241,"metadataOutputPath":242,"projectConfig":243,"language":251,"inheritFrom":259,"output":258,"version":244,"layout":260,"dictionaryDisplayName":261,"dictionaryHomeDirectory":262,"indexFileURI":263,"currentItemId":14,"currentItemLabel":25,"primRoot":264,"icon":265,"extensionName":266,"assetsRoot":246},"../../external/extensions/rnd/rnd/weighted-n-of-list-with-repeats.md","content/rnd/weighted-n-of-list-with-repeats.metadata.yaml",{"version":244,"projectRoot":245,"scanRoot":246,"outputRoot":247,"defaults":248,"engine":254,"partials":255,"dedupeIdenticalDiskWrites":258},"7.0.4",".","/home/runner/work/Helio/Helio/external/extensions/rnd","content",{"inheritFrom":249,"language":251,"output":252,"extension":239,"title":253,"version":244},[250],0,"en",false,"NetLogo User Manual","mustache",{"directoryPaths":256,"extensions":257},[245],[254,239],true,[250],"catalog","Rnd Extension Dictionary","/rnd.html","/_index/extensions/rnd.txt","rnd","i-mingcute-random-line",{"shortName":264,"fullName":267},"Rnd","/rnd/weighted-n-of-list-with-repeats",{"title":5,"description":238},"rnd/weighted-n-of-list-with-repeats","Vt0IZJX-opZj6evSwqYYjRAspZUbrFShoyb5ZcMAwTw",[273,278],{"title":274,"path":275,"stem":276,"description":277},"Rnd Extension Dictionary: weighted-n-of-list","/rnd/weighted-n-of-list","rnd/weighted-n-of-list","Documentation for the weighted-n-of-list primitive.",{"title":279,"path":280,"stem":281,"description":282},"Rnd Extension Dictionary: weighted-n-of-with-repeats","/rnd/weighted-n-of-with-repeats","rnd/weighted-n-of-with-repeats","Documentation for the weighted-n-of-with-repeats primitive.",1777657898489]