rsalumpit Posted July 31, 2009 Share Posted July 31, 2009 RAIN SNOW FOG WIND SPRING 30% 0% 30% 30% SUMMER 15% 0% 30% 30% FALL 10% 0% 30% 30% WINTER 10% 30% 40% 30% how can i base in the percentage of all the given data for example: spring has to be 30%(rain,snow,fog,wind) probability and make a random function with exact probobility? thnx guys Link to comment https://forums.phpfreaks.com/topic/168299-random-base-on-a-percentage/ Share on other sites More sharing options...
rsalumpit Posted July 31, 2009 Author Share Posted July 31, 2009 any help? Link to comment https://forums.phpfreaks.com/topic/168299-random-base-on-a-percentage/#findComment-887729 Share on other sites More sharing options...
TeNDoLLA Posted July 31, 2009 Share Posted July 31, 2009 Do you mean to calculate average for spring or? Link to comment https://forums.phpfreaks.com/topic/168299-random-base-on-a-percentage/#findComment-887775 Share on other sites More sharing options...
rsalumpit Posted July 31, 2009 Author Share Posted July 31, 2009 Do you mean to calculate average for spring or? i just need to randomize it but with percentage.. Link to comment https://forums.phpfreaks.com/topic/168299-random-base-on-a-percentage/#findComment-887777 Share on other sites More sharing options...
TeNDoLLA Posted July 31, 2009 Share Posted July 31, 2009 I dont get what you mean.. make an pseudo example ? Link to comment https://forums.phpfreaks.com/topic/168299-random-base-on-a-percentage/#findComment-887783 Share on other sites More sharing options...
lonewolf217 Posted July 31, 2009 Share Posted July 31, 2009 <?php $a = rand(1,100); ?> This will get a random number between 1 and 100 (to check the first condition) if the number is between 1 and 30, it will rain. 31-60 it will be foggy. 61-90 it will be windy. I guess 91-100 would be a clear sunny day ? that isn't really stipulated in your condition you can use the same basic calculation for the others Link to comment https://forums.phpfreaks.com/topic/168299-random-base-on-a-percentage/#findComment-887795 Share on other sites More sharing options...
rsalumpit Posted July 31, 2009 Author Share Posted July 31, 2009 <?php $a = rand(1,100); ?> This will get a random number between 1 and 100 (to check the first condition) if the number is between 1 and 30, it will rain. 31-60 it will be foggy. 61-90 it will be windy. I guess 91-100 would be a clear sunny day ? that isn't really stipulated in your condition you can use the same basic calculation for the others i think this is it man thanks ill try this..thnx to all Link to comment https://forums.phpfreaks.com/topic/168299-random-base-on-a-percentage/#findComment-887798 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.