本文整理汇总了C++中random_number函数的典型用法代码示例。如果您正苦于以下问题:C++ random_number函数的具体用法?C++ random_number怎么用?C++ random_number使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了random_number函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: connect_rooms
static void connect_rooms(cell_t *cell_arr, room_t *room_arr, int num_room)
{
int i, x, y;
path_node_c_t *path_arr, *curr_p;
heap_t *h;
room_t *room;
h = (heap_t *) malloc(sizeof(*h));
for(i = 1; i < num_room; i++)
{
room = room_arr + i;
x = random_number(room->x, room->x + room->width - 1);
y = random_number(room->y, room->y + room->height - 1);
heap_init(h, gen_path_node_cmp, NULL);
path_arr = (path_node_c_t *) malloc(MAP_HEIGHT * MAP_WIDTH *
sizeof(*path_arr));
initialize_heap(h, path_arr, cell_arr);
curr_p = path_arr + (MAP_WIDTH * y) + x;
curr_p->weight = 1;
curr_p->distance = 0;
curr_p->previous = NULL;
heap_decrease_key_no_replace(h, curr_p->heap_node);
create_corridor(h, path_arr);
room = room_arr + i - 1;
x = random_number(room->x, room->x + room->width - 1);
y = random_number(room->y, room->y + room->height - 1);
curr_p = path_arr + (MAP_WIDTH * y) + x;
place_corridor(curr_p, cell_arr);
heap_delete(h);
free(path_arr);
}
free(h);
}
开发者ID:wacharyzilson,项目名称:rogue_like_game,代码行数:41,代码来源:dungeon_generator.cpp
示例2: updateWorld
void updateWorld()
{
for(int n = 0; n < (0.5*P.N); ++n)
{
//pick a random cell
int x = random_number(P.sizeX);
int y = random_number(P.sizeY);
bool picked_viable = (bool)viable[x][y];
while(picked_viable == false)
{
x = random_number(P.sizeX);
y = random_number(P.sizeY);
picked_viable = (bool)viable[x][y];
}
//species at x,y dies and gets replaced
//with prob 1-m it is from within the local community
if(uniform() < P.m) //migration
{
species migrant = getSpeciesFromMetaCommunity();
world[x][y] = migrant;
}
else //no migration, local reproduction
{
int otherX = x; int otherY = y;
if(P.dispersalType == "Square") findParent_Square(otherX,otherY,x,y); //square
else if(P.dispersalType == "Circle") findParent_Circle(otherX,otherY,x,y); //circle
// else if(P.dispersalType == "Reflect") findParent_Reflect(otherX,otherY,x,y);
else findParent_Circle(otherX,otherY,x,y); //default
world[x][y] = world[otherX][otherY];
reproduction[otherX][otherY]++;
//world[x][y] = world[otherX][otherY];
if(uniform() < P.speciationRate) world[x][y] = newSpecies();
}
}
}
开发者ID:richelbilderbeek,项目名称:TheNeutralizer,代码行数:41,代码来源:spatial_neutrality.cpp
示例3: f_oldcrypt
void
f_oldcrypt (void) {
char *res, salt[3];
const char *choice =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./";
if (sp->type == T_STRING && SVALUE_STRLEN(sp) >= 2) {
salt[0] = sp->u.string[0];
salt[1] = sp->u.string[1];
free_string_svalue(sp--);
} else {
salt[0] = choice[random_number(strlen(choice))];
salt[1] = choice[random_number(strlen(choice))];
pop_stack();
}
salt[2] = 0;
res = string_copy(OLDCRYPT(sp->u.string, salt), "f_crypt");
free_string_svalue(sp);
sp->subtype = STRING_MALLOC;
sp->u.string = res;
}
开发者ID:Yuffster,项目名称:fluffOS,代码行数:21,代码来源:efuns_port.c
示例4: f_roll_MdN
void
f_roll_MdN() {
long roll = 0;
if ( (sp - 1)->u.number > 0 && sp->u.number > 0 ) {
while( (sp - 1)->u.number-- )
roll += 1 + random_number( sp->u.number );
}
pop_stack(); // Pop one...
sp->u.number = roll; // And change the other!
}
开发者ID:Yuffster,项目名称:fluffOS,代码行数:12,代码来源:dwlib.c
示例5: update
void update(RenderWindow & window, Group & group) {
if (group.location == 1) {
group.direction = random_number(4);
group.efect_number = random_number(3);
group.location++;
}
if (group.location == 2) {
switch (group.direction)
{
case 1: group.left(); break;
case 2: group.right(); break;
case 3: group.up(); break;
case 4: group.down(); break;
}
switch (group.efect_number)
{
case 1: group.effect_color(); break;
case 2: group.effect_rotate(); break;
case 3: group.effect_size(); break;
}
}
if (group.location == 3) {
switch (group.efect_number)
{
case 1: group.effect_color(); break;
case 2: group.effect_rotate(); break;
case 3: group.effect_size(); break;
}
switch (group.direction)
{
case 1: group.back_from_left(); break;
case 2: group.back_from_right(); break;
case 3: group.back_from_up(); break;
case 4: group.back_from_down(); break;
}
}
}
开发者ID:Coguar,项目名称:TP,代码行数:40,代码来源:Blocks.cpp
示例6: test_hash_set
void test_hash_set()
{
# if !(defined (_MSC_VER) && (_MSC_VER < 1100))
TestSet testSet, testSet2;
const size_t hash_setSize = random_number(random_base);
while ( testSet.size() < hash_setSize )
{
TestSet::value_type x;
testSet.insert( x );
testSet2.insert( TestSet::value_type() );
}
# if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE )
WeakCheck( testSet, test_hash_resize<TestSet>() );
// TestMultiSet == TestMultiSet: no such operator! - ptr
// StrongCheck( testSet, test_insert_noresize<TestSet>(testSet) );
# endif
WeakCheck( testSet, test_insert_value<TestSet>(testSet) );
size_t insCnt = random_number(random_base);
TestSet::value_type *insFirst = new TestSet::value_type[1+insCnt];
WeakCheck( testSet, insert_range_tester(testSet, insFirst, insFirst+insCnt) );
ConstCheck( 0, test_construct_pointer_range<TestSet>(insFirst, insFirst+insCnt) );
delete[] insFirst;
WeakCheck( testSet, insert_range_tester(testSet, testSet2.begin(), testSet2.end() ) );
ConstCheck( 0, test_default_construct<TestSet>() );
# if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION
ConstCheck( 0, test_construct_iter_range_n<TestSet>( testSet2 ) );
# endif
ConstCheck( testSet, test_copy_construct<TestSet>() );
WeakCheck( testSet, test_assign_op<TestSet>( testSet2 ) );
# endif
}
开发者ID:hoangduit,项目名称:reactos,代码行数:38,代码来源:test_hash_set.cpp
示例7: test_deque
void test_deque()
{
EH_STD::size_t dequeSize = random_number(random_base);
TestDeque emptyDeque;
TestDeque testDeque, testDeque2;
while ( testDeque.size() < dequeSize )
{
DQTestClass x;
testDeque.push_back( x );
testDeque2.push_back( DQTestClass() );
}
ConstCheck( testDeque, test_copy_construct<TestDeque>() );
WeakCheck( testDeque, test_insert_one<TestDeque>(testDeque) );
StrongCheck( testDeque, test_insert_one<TestDeque>(testDeque,0) );
StrongCheck( testDeque, test_insert_one<TestDeque>(testDeque, testDeque.size()) );
WeakCheck( testDeque, test_insert_n<TestDeque>(testDeque, random_number(random_base) ) );
StrongCheck( testDeque, test_insert_n<TestDeque>(testDeque, random_number(random_base), 0 ) );
StrongCheck( testDeque, test_insert_n<TestDeque>(testDeque, random_number(random_base), testDeque.size() ) );
EH_STD::size_t insCnt = random_number(random_base);
DQTestClass *insFirst = new TestDeque::value_type[insCnt+1];
WeakCheck( testDeque, insert_range_tester(testDeque, (DQTestClass *)insFirst,
insFirst+insCnt) );
StrongCheck( testDeque, insert_range_at_begin_tester(testDeque, (DQTestClass *)insFirst,
insFirst+insCnt) );
StrongCheck( testDeque, insert_range_at_end_tester(testDeque, (DQTestClass *)insFirst,
insFirst+insCnt) );
ConstCheck( 0, test_construct_pointer_range<TestDeque>( (DQTestClass *)insFirst,
insFirst+insCnt ) );
delete[] insFirst;
WeakCheck( testDeque, insert_range_tester(testDeque, testDeque2.begin(), testDeque2.end() ) );
StrongCheck( testDeque, test_push_back<TestDeque>(testDeque) );
StrongCheck( emptyDeque, test_push_back<TestDeque>(emptyDeque) );
StrongCheck( testDeque, test_push_front<TestDeque>(testDeque) );
StrongCheck( emptyDeque, test_push_front<TestDeque>(emptyDeque) );
ConstCheck( 0, test_default_construct<TestDeque>() );
ConstCheck( 0, test_construct_n<TestDeque>( random_number(random_base) ) );
ConstCheck( 0, test_construct_n_instance<TestDeque>( random_number(random_base) ) );
ConstCheck( 0, test_construct_iter_range<TestDeque>( testDeque2 ) );
testDeque2.resize( testDeque.size() * 3 / 2 );
WeakCheck( testDeque, test_assign_op<TestDeque>( testDeque2 ) );
testDeque2.resize( testDeque.size() * 2 / 3 );
WeakCheck( testDeque, test_assign_op<TestDeque>( testDeque2 ) );
}
开发者ID:RaymondLiao,项目名称:elektronika,代码行数:53,代码来源:test_deque.cpp
示例8: Particle
blueParticle::blueParticle(float x, float y, float dirx, float diry,GameState *state) : Particle(dirx,diry,state)
{
Load(state->getApp()->gettextureManager().Get("Content/particle.png"));
_colour = sf::Color(139,137,137,180);
SetPosition(x,y);
life_time_ = random_number( 0.08f, 0.3f );
direction = sf::Vector2f(dirx,diry);
speed = rand() % 40 + 90; // v2 in the range 1 to 100
}
开发者ID:ChrisMelling,项目名称:basicGame,代码行数:14,代码来源:blueParticle.cpp
示例9: init_branches
int init_branches(Triple *branches,
const EllipticCurve ec,
const Point P,
const Point Q)
{
BigInt aj, bj;
int i;
for(i = 0; i < L; i++) {
Point Rj, Ptemp, Qtemp;
aj = random_number(ec.order);
bj = random_number(ec.order);
ecc_mul(Ptemp, ec, aj, P);
ecc_mul(Qtemp, ec, bj, Q);
ecc_add(Rj, ec, Ptemp, Qtemp);
branches[i].c = aj;
branches[i].d = bj;
branches[i].point = Rj;
}
return 0;
}
开发者ID:carlosTJunior,项目名称:ECDLP,代码行数:23,代码来源:pollardrho.cpp
示例10: dust_bands
planets * starSystem::distributePlanetaryMasses(double inner_dust, double outer_dust)
{
double
a,
e,
mass,
crit_mass,
planetesimal_inner_bound,
planetesimal_outer_bound;
dust_bands* dust_head=new dust_bands(inner_dust,outer_dust);
planets *planet_head=0;
planets *&temp=planet_head;
isDustLeft=TRUE;
cloudEccentricity=0.2;
planetesimal_inner_bound = innermost_planet(starMass);
planetesimal_outer_bound = outermost_planet(starMass);
while (isDustLeft)
{
a = random_number(planetesimal_inner_bound,planetesimal_outer_bound);
e = random_eccentricity( );
mass = PROTOPLANET_MASS;
#ifdef VERBOSE
printf("Checking %10f AU: ",a);
#endif
if (dust_head->dustAvailable(inner_effect_limit(a, e, mass),outer_effect_limit(a, e, mass)))
{
#ifdef VERBOSE
printf(".. Injecting protoplanet.\n");
#endif
assert(a>0.0);
dustDensity = DUST_DENSITY_COEFF * sqrt(starMass) * exp(-ALPHA * pow(a,(1.0 / N)));
crit_mass = critical_limit(a,e,starLuminosity);
accreteDust(dust_head,mass,a,e,crit_mass,planetesimal_inner_bound,planetesimal_outer_bound);
if ((mass != 0.0) && (mass != PROTOPLANET_MASS))
coalescePlanetesimals(planet_head,dust_head,a,e,mass,crit_mass,
planetesimal_inner_bound,planetesimal_outer_bound);
#ifdef VERBOSE
else printf(".. failed due to large neighbor.\n");
#endif
}
#ifdef VERBOSE
else printf(".. failed.\n");
#endif
}
return temp;
}
开发者ID:zakski,项目名称:accrete-starform-stargen,代码行数:50,代码来源:system.cpp
示例11: choose_traits
npc::npc(cell_t *cell_arr, room_t *room_arr, int num_room, int seq)
{
traits = 0;
choose_traits();
turn = 0;
seen_x = 150;
seen_y = 150;
sequence = seq;
speed = random_number(5, 20);
place_monster(cell_arr, room_arr, num_room);
}
开发者ID:wacharyzilson,项目名称:rogue_like_game,代码行数:14,代码来源:npc.cpp
示例12: random_string
static void random_string(int length, char *str) {
int i;
int char_type;
for (i = 0; i < length; i++) {
char_type = (int) (3 * (rand() / (RAND_MAX + 1.0)));
switch (char_type) {
case 0:
str[i] = random_letter(0);
break;
case 1:
str[i] = random_letter(1);
break;
case 2:
str[i] = random_number();
break;
default:
str[i] = random_number();
break;
}
}
}
开发者ID:Datos2-2014,项目名称:Register-FS-Server,代码行数:23,代码来源:Disk_File.cpp
示例13: refraction_reflection
Vec refraction_reflection(const Vec &x , int depth, const Sphere &sph, const Ray &r, const Vec &n, const Vec &f, const Vec &nl){
Ray ray_refraction;
ray_refraction.origin= x;
ray_refraction.direction= r.direction-n*2*dot(n,r.direction);
double r_index_air=1, r_index_glass=1.5;
double r_index, ddn=dot(r.direction,nl), cos2t=0;
double temp111, temp112;
if(dot(n,nl)>0){
r_index = r_index_air/r_index_glass;
temp111 = 1;
}
else {
r_index = r_index_glass/r_index_air;
temp111 = -1;
}
Vec tdir = norm((r.direction*r_index - n*((temp111)*(ddn*r_index+sqrt(cos2t)))));
if(dot(n,nl)>0){
temp112 = -ddn;
}
else {
temp112 = dot(tdir,n);
}
double a=r_index_glass-r_index_air;
double b=r_index_glass+r_index_air;
double c = 1-(temp112);
double R0=a*a/(b*b), Re=R0+(1-R0)*c*c*c*c*c,Tr=1-Re,P=.25+.5*Re,RP=Re/P,TP=Tr/(1-P);
Ray rr3;
rr3.origin = x;
rr3.direction =tdir;
Vec temp_vector;
if(depth>2){
if(random_number()<P){
temp_vector = calculate_light(ray_refraction,depth)*RP;
}
else{
temp_vector = calculate_light(rr3,depth)*TP;
}
}
else{
temp_vector = calculate_light(ray_refraction,depth)*Re+calculate_light(rr3,depth)*Tr;
}
return sph.light + mult(f,temp_vector);
}
开发者ID:bipinkumar650,项目名称:Ray-Tracing,代码行数:50,代码来源:raytracing.cpp
示例14: shake_min_shrinked
bool zz_camera_follow::apply_shake (zz_time diff_time)
{
if (shake_lifetime == 0) return false;
if (shake_lifetime <= diff_time) {
shake_lifetime = 0; // do not modify
return true;
}
else {
shake_lifetime -= diff_time;
}
vec3 shakeed_cam_pos, shakeed_target_pos;
vec3 shake_min_shrinked(shake_min), shake_max_shrinked(shake_max);
shakeed_cam_pos = random_number(final_.camera_pos + shake_min_shrinked, final_.camera_pos + shake_max_shrinked);
shakeed_target_pos = random_number(last_.target_pos + shake_min_shrinked, last_.target_pos + shake_max_shrinked);
look_at(shakeed_cam_pos, shakeed_target_pos, vec3(0, 0, 1));
return true;
}
开发者ID:eaglescv,项目名称:znzin,代码行数:23,代码来源:zz_camera_follow.cpp
示例15: main
int main()
{
set_random_limit(1000);
clock_t tbeg = clock();
int i = 1;
while(true) {
int tm = random_number();
std::cout<<"["<<i<<"]\t"<<tm<<"\t";
++i;
if (i>1000) break;
tm = random_number();
std::cout<<"["<<i<<"]\t"<<tm<<"\t";
tm = random_number();
++i;
if (i>1000) break;
std::cout<<"["<<i<<"]\t"<<tm<<"\n";
++i;
if (i>1000) break;
}
clock_t tend = clock();
std::cout<<"______________\ntakes "<<static_cast<double>(tend-tbeg)/CLOCKS_PER_SEC
<<" seconds\n";
return 0;
}
开发者ID:Parlefan,项目名称:cpp,代码行数:24,代码来源:test_for_random_number.cpp
示例16: test_rope
void test_rope()
{
TestRope testRope, testRope2;
size_t ropeSize = random_number(random_base);
while ( testRope.size() < ropeSize )
{
TestRope::value_type x = TestRope::value_type(random_number(random_base)); // initialize before use
testRope.push_back( x );
testRope2.push_back( TestRope::value_type() );
}
WeakCheck( testRope, test_insert_one<TestRope>(testRope) );
WeakCheck( testRope, test_insert_one<TestRope>(testRope, 0) );
WeakCheck( testRope, test_insert_one<TestRope>(testRope, (int)testRope.size()) );
WeakCheck( testRope, test_insert_n<TestRope>(testRope, random_number(random_base) ) );
WeakCheck( testRope, test_insert_n<TestRope>(testRope, random_number(random_base), 0 ) );
WeakCheck( testRope, test_insert_n<TestRope>(testRope, random_number(random_base), (int)testRope.size() ) );
size_t insCnt = random_number(random_base);
TestRope::value_type *insFirst = new TestRope::value_type[1+insCnt];
WeakCheck( testRope, insert_range_tester(testRope, insFirst, insFirst+insCnt) );
WeakCheck( testRope, insert_range_at_begin_tester(testRope, insFirst, insFirst+insCnt) );
WeakCheck( testRope, insert_range_at_end_tester(testRope, insFirst, insFirst+insCnt) );
ConstCheck( 0, test_construct_pointer_range<TestRope>(insFirst, insFirst+insCnt) );
delete[] insFirst;
WeakCheck( testRope, insert_range_tester(testRope, testRope2.begin(), testRope2.end() ) );
WeakCheck( testRope, test_push_front<TestRope>(testRope) );
WeakCheck( testRope, test_push_back<TestRope>(testRope) );
ConstCheck( 0, test_default_construct<TestRope>() );
// dwa 1/25/00 - not actually valid for rope, because it doesn't
// have the constructor in question! The code will compile, but with the
// wrong result (the constructor that gets used does something different).
// ConstCheck( 0, test_construct_n<TestRope>( random_number(random_base) ) );
ConstCheck( 0, test_construct_n_instance<TestRope>( random_number(random_base) ) );
ConstCheck( 0, test_construct_iter_range<TestRope>( testRope2 ) );
ConstCheck( testRope, test_copy_construct<TestRope>() );
WeakCheck( testRope, test_assign_op<TestRope>( testRope2 ) );
}
开发者ID:3runo5ouza,项目名称:rhodes,代码行数:48,代码来源:test_rope.cpp
示例17: main
int
main (int argc, char *argv[])
{
int *sray, *rray;
int *sdisp, *scounts, *rdisp, *rcounts;
int ssize, rsize, i, k, j;
float z;
init_it (&argc, &argv);
scounts = (int *) shmem_malloc (sizeof (int) * numnodes);
rcounts = (int *) shmem_malloc (sizeof (int) * numnodes);
sdisp = (int *) shmem_malloc (sizeof (int) * numnodes);
rdisp = (int *) shmem_malloc (sizeof (int) * numnodes);
/*
! seed the random number generator with a ! different number on each
processor */
seed_random (myid);
/* find data to send */
for (i = 0; i < numnodes; i++) {
random_number (&z);
scounts[i] = (int) (10.0 * z) + 1;
}
printf ("-------myid= %d scounts=", myid);
for (i = 0; i < numnodes; i++) {
printf ("%d ", scounts[i]);
}
printf ("\n");
/* send the data */
// mpi_err = MPI_Alltoall(scounts,1,MPI_INT, rcounts,1,MPI_INT,
// MPI_COMM_WORLD);
shmem_barrier_all ();
int other, j1;
for (j1 = 0; j1 < numnodes; j1++) {
shmem_int_put (&rcounts[myid], &scounts[j1], 1, j1);
}
shmem_barrier_all ();
printf ("myid= %d rcounts=", myid);
for (i = 0; i < numnodes; i++) {
printf ("%d ", rcounts[i]);
}
printf ("\n");
shmem_finalize ();
return 0;
}
开发者ID:kseager,项目名称:openshmem-examples,代码行数:45,代码来源:shmem_all.c
示例18: test_rope
void test_rope()
{
TestValarray testValarray, testValarray2;
size_t ropeSize = random_number(random_base);
while ( testValarray.size() < ropeSize )
{
TestValarray::value_type x = random_number(random_base) ; // initialize before use
testValarray.push_back( x );
testValarray2.push_back( TestValarray::value_type() );
}
WeakCheck( testValarray, test_insert_one<TestValarray>(testValarray) );
WeakCheck( testValarray, test_insert_one<TestValarray>(testValarray, 0) );
WeakCheck( testValarray, test_insert_one<TestValarray>(testValarray, testValarray.size()) );
WeakCheck( testValarray, test_insert_n<TestValarray>(testValarray, random_number(random_base) ) );
WeakCheck( testValarray, test_insert_n<TestValarray>(testValarray, random_number(random_base), 0 ) );
WeakCheck( testValarray, test_insert_n<TestValarray>(testValarray, random_number(random_base), testValarray.size() ) );
size_t insCnt = random_number(random_base);
TestValarray::value_type *insFirst = new TestValarray::value_type[1+insCnt];
WeakCheck( testValarray, insert_range_tester(testValarray, insFirst, insFirst+insCnt) );
WeakCheck( testValarray, insert_range_at_begin_tester(testValarray, insFirst, insFirst+insCnt) );
WeakCheck( testValarray, insert_range_at_end_tester(testValarray, insFirst, insFirst+insCnt) );
ConstCheck( 0, test_construct_pointer_range<TestValarray>(insFirst, insFirst+insCnt) );
delete[] insFirst;
WeakCheck( testValarray, insert_range_tester(testValarray, testValarray2.begin(), testValarray2.end() ) );
WeakCheck( testValarray, test_push_front<TestValarray>(testValarray) );
WeakCheck( testValarray, test_push_back<TestValarray>(testValarray) );
ConstCheck( 0, test_default_construct<TestValarray>() );
ConstCheck( 0, test_construct_n<TestValarray>( random_number(random_base) ) );
ConstCheck( 0, test_construct_n_instance<TestValarray>( random_number(random_base) ) );
ConstCheck( 0, test_construct_iter_range<TestValarray>( testValarray2 ) );
ConstCheck( testValarray, test_copy_construct<TestValarray>() );
WeakCheck( testValarray, test_assign_op<TestValarray>( testValarray2 ) );
}
开发者ID:Arkshine,项目名称:NS,代码行数:42,代码来源:test_valarray.cpp
示例19: main
int main(){
for(int i = 0; i < COUNT; ++i){
float result = random_number(0, MAX);
int bin = (int)result;
assert(bin >= 0);
assert(bin < MAX);
++bins[bin];
}
printf("# bin\tcount\n");
for(int i = 0; i < MAX; ++i){
printf("%i\t%u\n", i, bins[i]);
}
return 0;
}
开发者ID:bluecube,项目名称:bonsai-raytracer,代码行数:19,代码来源:random_number.c
示例20: main
int main(int argc,char *argv[])
{
int N=atoi(argv[1]),i;
double average=0,standard_deviation=0;
number_t x;
srand((unsigned)time(NULL));
for(i=1;i<=N;i++){
x=random_number();
average+=(double)x/N;
standard_deviation+=(double)x*x/N;
}
standard_deviation=sqrt(standard_deviation-average*average);
printf("average:%f\n",average);
printf("standard_deviation:%f\n",standard_deviation);
return(0);
}
开发者ID:algking,项目名称:Algorithms-in-C-Sedgewick,代码行数:19,代码来源:B3.2_types_of_numbers.c
注:本文中的random_number函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论