terraria-cpp2il-methodrecon v1.4.4.9
Terraria mobile dump, with reconstructed method body. Dump with CallAnalysis: https://infinitynichto.github.io/terraria-cpp2il
Loading...
Searching...
No Matches
WeightedRandom.cs
Go to the documentation of this file.
1using System;
3
4namespace Terraria.Utilities
5{
6 // Token: 0x02000509 RID: 1289
7 public class WeightedRandom<T>
8 {
9 // Token: 0x06003127 RID: 12583 RVA: 0x001F7A38 File Offset: 0x001F5C38
11 {
12 this.elements = 1;
13 this.needsRefresh = true;
14 base..ctor();
15 }
16
17 // Token: 0x06003128 RID: 12584 RVA: 0x001F7A5C File Offset: 0x001F5C5C
18 public WeightedRandom(int seed)
19 {
20 this.elements = 1;
21 this.needsRefresh = true;
22 base..ctor();
23 }
24
25 // Token: 0x06003129 RID: 12585 RVA: 0x001F7A80 File Offset: 0x001F5C80
27 {
28 this.elements = this;
29 this.needsRefresh = true;
30 base..ctor();
32 }
33
34 // Token: 0x0600312A RID: 12586 RVA: 0x001F7AA8 File Offset: 0x001F5CA8
42
43 // Token: 0x0600312B RID: 12587 RVA: 0x001F7AD0 File Offset: 0x001F5CD0
45 {
46 this.elements = 1;
47 this.needsRefresh = true;
48 base..ctor();
50 }
51
52 // Token: 0x0600312C RID: 12588 RVA: 0x001F7AF8 File Offset: 0x001F5CF8
61
62 // Token: 0x0600312D RID: 12589 RVA: 0x001F7B28 File Offset: 0x001F5D28
63 public void Add(T element, double weight = 1.0)
64 {
65 List list = this.elements;
66 this.needsRefresh = true;
67 }
68
69 // Token: 0x0600312E RID: 12590 RVA: 0x001F7B44 File Offset: 0x001F5D44
70 public T Get()
71 {
72 if (this.needsRefresh)
73 {
74 }
76 double num = unifiedRandom.NextDouble();
77 List list = this.elements;
78 if (false || 6 == 0)
79 {
80 }
81 throw new OutOfMemoryException();
82 }
83
84 // Token: 0x0600312F RID: 12591 RVA: 0x001F7B88 File Offset: 0x001F5D88
86 {
87 List list = this.elements;
88 }
89
90 // Token: 0x06003130 RID: 12592 RVA: 0x001F7BB4 File Offset: 0x001F5DB4
91 public void Clear()
92 {
93 List list = this.elements;
94 }
95
96 // Token: 0x06003131 RID: 12593 RVA: 0x001F7BC8 File Offset: 0x001F5DC8
98 {
99 /*
100An exception occurred when decompiling this method (06003131)
101
102ICSharpCode.Decompiler.DecompilerException: Error decompiling T Terraria.Utilities.WeightedRandom`1::op_Implicit(Terraria.Utilities.WeightedRandom`1<T>)
103
104 ---> System.Exception: Basic block has to end with unconditional control flow.
105{
106 Block_0:
107 stloc:bool(var_0_06, ldfld:bool(WeightedRandom`1::needsRefresh, ldloc:class Terraria.Utilities.WeightedRandom`1<!T>[exp:WeightedRandom`1](weightedRandom)))
108 stloc:bool(var_1_0D, ldfld:bool(WeightedRandom`1::needsRefresh, ldloc:class Terraria.Utilities.WeightedRandom`1<!T>[exp:WeightedRandom`1](weightedRandom)))
109}
110
111 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
112 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
113 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
114 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
115 --- End of inner exception stack trace ---
116 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
117 at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1683
118*/;
119 }
120
121 // Token: 0x04003AF7 RID: 15095
123
124 // Token: 0x04003AF8 RID: 15096
126
127 // Token: 0x04003AF9 RID: 15097
128 public bool needsRefresh;
129
130 // Token: 0x04003AFA RID: 15098
131 private double _totalWeight;
132 }
133}
class f__AnonymousType0<< Count > j__TPar
void Add(T element, double weight=1.0)
WeightedRandom(UnifiedRandom random, params Tuple< T, double >[] theElements)
WeightedRandom(int seed, params Tuple< T, double >[] theElements)
WeightedRandom(params Tuple< T, double >[] theElements)
readonly List< Tuple< T, double > > elements
WeightedRandom(UnifiedRandom random)