Skip to content

Warning: implicit conversion from 'int' to 'float' (RAND_MAX) #53

@powof2

Description

@powof2

Hi there,
par_shapes.h:1103:32:

warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion] note: expanded from macro 'RAND_MAX' 

maybe change like this ? or do a c-style cast for RAND_MAX?

// float r = (float) rand() / RAND_MAX; float r = rand() / (RAND_MAX + 1.0f); // [0, 1) float r = rand() / (float)RAND_MAX; // [0, 1] 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions