Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-23-2013, 03:15 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Sounds a bit like "normal distribution", or "the bell curve." You can generate numbers that act like that using the "Box–Muller transform." Look up these things.

My attempt at implementing it in GScript:
PHP Code:
function normal() {
  
temp.2.7182818284590452353602874713526624977572470936999;
  return 
cos(2*pi*random(01)) * (-log(temp.erandom(01)))^0.5;

It generates numbers that are more likely to be close to 0.

If you know in advance that you only need numbers 1 through 10 it's probably easier to do it another way.
__________________
Testbed user: I figured since I can never find any scripters it was time to take desperate measures...and...TEACH MYSELF 0.0
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:35 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.