Thank you to everyone
Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance
I will have to experiment a bit, but you folks gave me some useful
suggestions.
Thanks so much.
Michael
"Michael Hesse" <mhesse@xxxxxxxxxxxxx> wrote in message
news:u4DMl.15872$hc1.7662@xxxxxxxxxxxxxxxxxxxxxxx
I have an array, where each element has two items. The second item is a
float that goes up in value.
1 0.005
2 0.145
4 0.853
5 1.431
6 1.900
9 2.454
11 3.000
I then pick a random number between 1 and 3. I want to find the element
that is >= the random number.
I can do a binary search, but I was wondering if there is a faster way to
do this.Some of these arrays have a lot of elements and I do this a lot.
Thanks for any help.
Michael
.
Relevant Pages
- Re: float arrays from C++ to C#
... several images are sent to a delegate as float* arrays as ... And i'm trying my C# client to get these float* arrays to map them into ... public delegate void ImageProgressReporterDelegate(floatRGB, int ... (microsoft.public.dotnet.languages.csharp) - Re: General Protection Exception
... Jack Klein wrote: ... arrays, I get a General Protection Exception error message. ... The (float*) cast in the two initializations is completely unnecessary ... When you try to write to memory through a null pointer, ... (comp.lang.c) - Re: General Protection Exception
... arrays, I get a General Protection Exception error message. ... int main ... The (float*) cast in the two initializations is completely unnecessary ... When you try to write to memory through a null pointer, ... (comp.lang.c) - Re: Making a program quicker tips...
... For the same reason prefer index access to C arrays over pointer ... If there is a pointer to an array the compiler cannot be sure ... float b,c; ... (comp.lang.cpp) - Re: file data => array(s)
... I'd like to read this into four arrays, ... numbers, if you convert text like "0.1" to a float, you don't get 0.1, ... here is an advanced technique using itertools: ... Be warned that this version throws away any partial group left over at ... (comp.lang.python) |
|