Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type private baseSampler(n,sets, samplingMethod, length) =
- member this.samplerMap : (float*float)[][] = Array.init sets (fun i -> (samplingMethod n))
- member this.indexMap : ConcurrentDictionary<int,int> = new ConcurrentDictionary<int,int>()
- member this.setMap : ConcurrentDictionary<int,int> = new ConcurrentDictionary<int,int>()
- member this.n = n
- member this.sets = sets
- member this.length = length
- member this.getNext (id:int) =
- if this.indexMap.IsEmpty || (not (this.indexMap.ContainsKey(id)))
- then
- let s = this.indexMap.TryAdd (id, (this.samplerMap.[0].Length-1))
- printf "did I add? %b" s // THIS PRINTS TRUE!!!
- Console.ReadLine() |> ignore
- if this.setMap.IsEmpty || (not (this.setMap.ContainsKey(id)))
- then
- this.setMap.TryAdd (id, ran.Next(0,this.samplerMap.Length-1)) |> ignore
- let returnIndex = this.indexMap.Item id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement