Skip to content

Commit 2c9fb40

Browse files
committed
bench: create ordered ndarray instead of randomized one
1 parent 213848f commit 2c9fb40

1 file changed

Lines changed: 1 addition & 15 deletions

File tree

lib/node_modules/@stdlib/stats/base/ndarray/smediansorted/benchmark/c/benchmark.length.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <stdlib.h>
2727
#include <stdio.h>
2828
#include <math.h>
29-
#include <time.h>
3029
#include <sys/time.h>
3130

3231
#define NAME "smediansorted"
@@ -83,16 +82,6 @@ static double tic( void ) {
8382
return (double)now.tv_sec + (double)now.tv_usec/1.0e6;
8483
}
8584

86-
/**
87-
* Generates a random number on the interval [0,1).
88-
*
89-
* @return random number
90-
*/
91-
static float rand_float( void ) {
92-
int r = rand();
93-
return (float)r / ( (float)RAND_MAX + 1.0f );
94-
}
95-
9685
/**
9786
* Runs a benchmark.
9887
*
@@ -128,7 +117,7 @@ static double benchmark( int iterations, int len ) {
128117

129118
data = (float *)malloc( len * sizeof( float ) );
130119
for ( i = 0; i < len; i++ ) {
131-
data[ i ] = ( rand_float() * 20000.0f ) - 10000.0f;
120+
data[ i ] = (float)i;
132121
}
133122
// cppcheck-suppress invalidPointerCast
134123
x = stdlib_ndarray_allocate( STDLIB_NDARRAY_FLOAT32, (uint8_t *)data, ndims, shape, strides, offset, order, imode, nsubmodes, submodes );
@@ -165,9 +154,6 @@ int main( void ) {
165154
int i;
166155
int j;
167156

168-
// Use the current time to seed the random number generator:
169-
srand( time( NULL ) );
170-
171157
print_version();
172158
count = 0;
173159
for ( i = MIN; i <= MAX; i++ ) {

0 commit comments

Comments
 (0)