Skip to content

Instantly share code, notes, and snippets.

@eevee
Created January 3, 2018 02:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save eevee/9ee0a48063845903bae257f1fd6aa640 to your computer and use it in GitHub Desktop.
generating a random angle by picking (x, y) from various distributions with 1M trials
random.betavariate(2, 2) * 2 - 1
0 | ###########################################################################
10 | ###############################################################################
20 | #####################################################################################
30 | #############################################################################################
40 | ###################################################################################################
50 | ##############################################################################################
60 | #####################################################################################
70 | ###############################################################################
80 | ############################################################################
90 | #############################################################################
100 | ###############################################################################
110 | ####################################################################################
120 | ##############################################################################################
130 | ###################################################################################################
140 | ##############################################################################################
150 | #####################################################################################
160 | ##############################################################################
170 | ############################################################################
180 | ############################################################################
190 | ##############################################################################
200 | #####################################################################################
210 | ##############################################################################################
220 | ##################################################################################################
230 | ##############################################################################################
240 | #####################################################################################
250 | ##############################################################################
260 | ###########################################################################
270 | ###########################################################################
280 | ###############################################################################
290 | ######################################################################################
300 | #############################################################################################
310 | ####################################################################################################
320 | #############################################################################################
330 | #####################################################################################
340 | ################################################################################
350 | ############################################################################
random.gauss(0, 1)
0 | ##################################################################################################
10 | ##################################################################################################
20 | ##################################################################################################
30 | ##################################################################################################
40 | #################################################################################################
50 | #################################################################################################
60 | ###################################################################################################
70 | ##################################################################################################
80 | ##################################################################################################
90 | ##################################################################################################
100 | ##################################################################################################
110 | ##################################################################################################
120 | ##################################################################################################
130 | ###################################################################################################
140 | ###################################################################################################
150 | ##################################################################################################
160 | ##################################################################################################
170 | ####################################################################################################
180 | ###################################################################################################
190 | ###################################################################################################
200 | ###################################################################################################
210 | ##################################################################################################
220 | ##################################################################################################
230 | ##################################################################################################
240 | ###################################################################################################
250 | ##################################################################################################
260 | ##################################################################################################
270 | ##################################################################################################
280 | ###################################################################################################
290 | #################################################################################################
300 | ##################################################################################################
310 | ###################################################################################################
320 | ##################################################################################################
330 | ###################################################################################################
340 | ###################################################################################################
350 | ##################################################################################################
random.triangular(-1, 1)
0 | ################################################################################################
10 | ############################################################################################
20 | #############################################################################################
30 | ###############################################################################################
40 | ####################################################################################################
50 | ################################################################################################
60 | ############################################################################################
70 | ############################################################################################
80 | ###############################################################################################
90 | ################################################################################################
100 | ############################################################################################
110 | #############################################################################################
120 | ################################################################################################
130 | ###################################################################################################
140 | ###############################################################################################
150 | #############################################################################################
160 | ############################################################################################
170 | ###############################################################################################
180 | ###############################################################################################
190 | #############################################################################################
200 | #############################################################################################
210 | ###############################################################################################
220 | ##################################################################################################
230 | ###############################################################################################
240 | ###########################################################################################
250 | ############################################################################################
260 | ################################################################################################
270 | ################################################################################################
280 | #############################################################################################
290 | #############################################################################################
300 | ###############################################################################################
310 | ##################################################################################################
320 | ################################################################################################
330 | #############################################################################################
340 | ###########################################################################################
350 | ###############################################################################################
random.random() * 2 - 1
0 | ######################################################
10 | #########################################################
20 | #################################################################
30 | #################################################################################
40 | ###################################################################################################
50 | ################################################################################
60 | ##################################################################
70 | #########################################################
80 | ######################################################
90 | #####################################################
100 | #########################################################
110 | #################################################################
120 | #################################################################################
130 | ###################################################################################################
140 | ################################################################################
150 | #################################################################
160 | ##########################################################
170 | ######################################################
180 | ######################################################
190 | ##########################################################
200 | ##################################################################
210 | ################################################################################
220 | ####################################################################################################
230 | ################################################################################
240 | #################################################################
250 | #########################################################
260 | #######################################################
270 | ######################################################
280 | #########################################################
290 | #################################################################
300 | ################################################################################
310 | ###################################################################################################
320 | ################################################################################
330 | #################################################################
340 | #########################################################
350 | ######################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment