<commit_before>from __future__ import division
import sys                                            
import numpy as np
from random import randrange
import math
import random

"""This script codes lognormal models """ # playing around with this 

""" N = Total abundance #copied from RandFrac_1 
    S = Number of Species (Total Abundance)
    sample_size = Sample Size"""
    
'''def broken_stk(N, S, sample_size): 
    RAC_samples = []
    while len(RAC_samples) < sample_size:
        RAC = [N]
        
        while len(RAC) < S:'''

N = 20
S = 4
sample_size = 10
            
 #something i found on stack overflow to generate a list of random numbers summing to 1, now just trying to figure out how to change what they sum up to.
RAC = [] 
s = 0
for i in range(N):
    r = random.random()
    s += r
    RAC.append(r)
print RAC #this gives me random float numbers 



'''for i in range(sample_size): # this is giving me just random nums between 0 and N, but not sure how to figure out how to make them sum to N
    print random.randrange(0, N, 1)



RAC = [] #this gives me S random divisions of N but haven't yet figured out how to make sure they sum to N
for i in xrange(S-1):
    maxSize = math.ceil(N/(S - len(RAC)))
    newSize = random.randint(0, maxSize)
    n = N - newSize
    RAC.append(newSize)
RAC.append(n)
print RAC     '''
            <commit_msg>Created code that creates splits in number of individuals -NH<commit_after>from __future__ import division
import sys                                            
import numpy as np
from random import randrange
import math
import random



'''def BrokenStick(N, S, sample_size):

    """This script codes Broken Stick models """ # playing around with this 
    #N = number of individuals
    #S = number of species
    #sample_size = number of rank abundance vectors to be generated'''
'''just some thoughts on how to make this work.  Create list of range of N, then make S - 1 random divisions in range of N, repeat sample_size times.'''
#i now have values that represent divisions in N not the number of individuals in each species

N = 20
S = 4
sample_size = 10

n = range(N) # creates range of N 
print n
s = S-1 #number of divisions(species minus 1)

cuts = random.sample(set(n), s) #randomly selecting s number of items in range 
cuts.sort(reverse = True) #sorts numbers
print cuts #gives where the range is split 
{'fraction_non_alphanumeric': 0.07705192629815745, 'fraction_numerical': 0.008793969849246231, 'mean_word_length': 2.798092209856916, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '729304', 'n_tokens_mistral': 718, 'n_tokens_neox': 681, 'n_words': 330}