Post Reply 
MCODE: random numbers
04-21-2019, 02:03 AM
Post: #5
RE: MCODE: random numbers
(04-21-2019 01:35 AM)Albert Chan Wrote:  If you don't mind tiny non-biased random modulo, it can be done with a multiply and a shift.

see first version of random_bounded() in https://lemire.me/blog/2016/06/30/fast-r...shuffling/

Non-biased modulo is not much harder, see the second version.
This required some random number samples to be rejected.

Also, I had conversations with Lemire about how divisionless random code work.
On the last post, there is a link to a paper about it.

Albert, Thanks for this information. Just what I was looking for!
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
MCODE: random numbers - RobertM - 04-20-2019, 09:43 PM
RE: MCODE: random numbers - John Keith - 04-20-2019, 10:12 PM
RE: MCODE: random numbers - RobertM - 04-20-2019, 10:40 PM
RE: MCODE: random numbers - Albert Chan - 04-21-2019, 01:35 AM
RE: MCODE: random numbers - RobertM - 04-21-2019 02:03 AM
RE: MCODE: random numbers - Mark Power - 05-03-2019, 09:21 PM



User(s) browsing this thread: 1 Guest(s)