Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
bowtie programming fancy Bioinformatics 1 09-29-2011 04:23 PM
Basic programming question: Very large hash tables henning General 7 07-08-2011 07:17 AM
[ sequence alignments, big data, bio informatics ] x [ programming and UI design ] delinquentme Bioinformatics 1 07-04-2011 09:54 PM
Re: New to programming need help for inserting text kapoormanav Bioinformatics 5 07-09-2010 01:23 PM

Thread Tools
Old 10-24-2011, 10:37 PM   #1
advancing one byte at a time!
Location: Bangalore, India

Join Date: Jun 2011
Posts: 56
Question C programming question

Hey guys,

I'm writing a c code which requires me to choose a random location within the entire genome. Using rand() or lrand48() functions the max attainable value is ~2.1 x 10^9 which is roughly 2/3 of the size of the human genome (~ 3.1x 10^9). Can i get some suggestions on how to choose the location over the genome? I have 2 ideas but i'm not sure of they're ok...

1. add (2*rand() )%genome size
2. (rand() + rand() )%genome size()
3. (rand() * (rand()%1,500,000,000) )%genome_size

1 and 2 will favour larger numbers and i have no idea wat 3 will give

Thanx in advance!
arkal is offline   Reply With Quote
Old 10-24-2011, 11:48 PM   #2
Location: Oregon

Join Date: Feb 2011
Posts: 29

include a RNG of your choice instead of the built in ones if they are insufficient
there many to choose from. Maybe a "Mersenne twister" here is an implementation (no affiliation)

features claim "Variety of formats: integer and double, 32- and 64-bit. "
tomc is offline   Reply With Quote

c programming random

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -8. The time now is 02:45 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO