python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Is it possible to uniformly generate a random infinite bitstring lazily?
I tried to build an RNG that uniformly randomly chooses amongst 3 items. Because, the common idiom (something like C's rand() % 3) is prone to modulo bias, and thus not uniform.
As per the notion of a...
Dannyu NDos
Votes: 0
Answers: 2
Trying to use an Int RandomIO val in my chart
I am new to monads in Haskell.
I was trying to write a scatter graph with Haskell-chart that would plot 20 points with strong (but not perfect) positive correlation. Example of what I was trying to do...
m1531
Votes: 0
Answers: 1
Breaking the loop
I have the following code sample:
data Smth = A | B
data MyError = MkMyError
data MyState = MkMyState
run :: [Smth] -> Either MyError (Maybe Integer)
run param =
evalState
( foldM
...
xbalaj
Votes: 0
Answers: 1
Two almost identical functions using STArray: why does one requires FlexibleContexts, and the other does not?
Consider the Haskell functions
test :: ST s [Int]
test = do
arr <- newListArray (0,9) [0..9] :: ST s (STArray s Int Int)
let f i = do writeArray arr i (2*i)
readArray arr i...
Mark Wildon
Votes: 0
Answers: 1